summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorrichard <none@none>2009-10-27 10:51:34 -0700
committerrichard <none@none>2009-10-27 10:51:34 -0700
commit9589ee3f702c96da9aec3e747c75eec43938240a (patch)
treec40509b9d10c2d0786af20e64f79cefdda5711c0 /indra
parent7f3af8bc388e99d3ca9ce3f685346e1db07af20f (diff)
EXT-1727 Chat history widget has no context menu for copy/paste operations
added ignore for dbghelp.dll reviewed by James
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/lltexteditor.cpp36
-rw-r--r--indra/llui/lltexteditor.h4
-rw-r--r--indra/newview/skins/default/xui/en/menu_text_editor.xml54
3 files changed, 92 insertions, 2 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 0ca9a18e0c..d0119ea424 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -63,6 +63,7 @@
#include "llpanel.h"
#include "llurlregistry.h"
#include "lltooltip.h"
+#include "llmenugl.h"
#include <queue>
#include "llcombobox.h"
@@ -252,7 +253,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mHandleEditKeysDirectly( p.handle_edit_keys_directly ),
mMouseDownX(0),
mMouseDownY(0),
- mTabsToNextField(p.ignore_tab)
+ mTabsToNextField(p.ignore_tab),
+ mContextMenu(NULL)
{
mDefaultFont = p.font;
@@ -301,6 +303,8 @@ LLTextEditor::~LLTextEditor()
// Scrollbar is deleted by LLView
std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
+
+ delete mContextMenu;
}
////////////////////////////////////////////////////////////
@@ -702,6 +706,19 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
return handled;
}
+BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+ BOOL handled = LLTextBase::handleRightMouseDown(x, y, mask);
+ if (!handled && hasTabStop())
+ {
+ setFocus( TRUE );
+ showContextMenu(x, y);
+ handled = TRUE;
+ }
+ return handled;
+}
+
+
BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
{
@@ -736,7 +753,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
setCursorAtLocalPos( clamped_x, clamped_y, true );
mSelectionEnd = mCursorPos;
}
-
+imageoverlay
lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;
getWindow()->setCursor(UI_CURSOR_IBEAM);
handled = TRUE;
@@ -1991,6 +2008,21 @@ void LLTextEditor::setEnabled(BOOL enabled)
}
}
+void LLTextEditor::showContextMenu(S32 x, S32 y)
+{
+ if (!mContextMenu)
+ {
+ mContextMenu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_text_editor.xml",
+ LLMenuGL::sMenuContainer,
+ LLMenuHolderGL::child_registry_t::instance());
+ }
+
+ S32 screen_x, screen_y;
+ localPointToScreen(x, y, &screen_x, &screen_y);
+ mContextMenu->show(screen_x, screen_y);
+}
+
+
void LLTextEditor::drawPreeditMarker()
{
static LLUICachedControl<F32> preedit_marker_brightness ("UIPreeditMarkerBrightness", 0);
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 481a4d1a78..4847f4d117 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -99,6 +99,7 @@ public:
// mousehandler overrides
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask );
virtual BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask);
@@ -201,6 +202,7 @@ public:
void getSelectedSegments(segment_vec_t& segments) const;
protected:
+ void showContextMenu(S32 x, S32 y);
void drawPreeditMarker();
void assignEmbedded(const std::string &s);
@@ -328,6 +330,8 @@ private:
LLCoordGL mLastIMEPosition; // Last position of the IME editor
keystroke_signal_t mKeystrokeSignal;
+
+ LLContextMenu* mContextMenu;
}; // end class LLTextEditor
diff --git a/indra/newview/skins/default/xui/en/menu_text_editor.xml b/indra/newview/skins/default/xui/en/menu_text_editor.xml
new file mode 100644
index 0000000000..7c9e6f0796
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_text_editor.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<context_menu
+ name="Text editor context menu">
+ <menu_item_call
+ label="Cut"
+ layout="topleft"
+ name="Cut"
+ shortcut="control|X">
+ <menu_item_call.on_click
+ function="Edit.Cut" />
+ <menu_item_call.on_enable
+ function="Edit.EnableCut" />
+ </menu_item_call>
+ <menu_item_call
+ label="Copy"
+ layout="topleft"
+ name="Copy"
+ shortcut="control|C">
+ <menu_item_call.on_click
+ function="Edit.Copy" />
+ <menu_item_call.on_enable
+ function="Edit.EnableCopy" />
+ </menu_item_call>
+ <menu_item_call
+ label="Paste"
+ layout="topleft"
+ name="Paste"
+ shortcut="control|V">
+ <menu_item_call.on_click
+ function="Edit.Paste" />
+ <menu_item_call.on_enable
+ function="Edit.EnablePaste" />
+ </menu_item_call>
+ <menu_item_call
+ label="Delete"
+ layout="topleft"
+ name="Delete"
+ shortcut="Del">
+ <menu_item_call.on_click
+ function="Edit.Delete" />
+ <menu_item_call.on_enable
+ function="Edit.EnableDelete" />
+ </menu_item_call>
+ <menu_item_call
+ label="Select All"
+ layout="topleft"
+ name="Select All"
+ shortcut="control|A">
+ <menu_item_call.on_click
+ function="Edit.SelectAll" />
+ <menu_item_call.on_enable
+ function="Edit.EnableSelectAll" />
+ </menu_item_call>
+</context_menu>