From 9589ee3f702c96da9aec3e747c75eec43938240a Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 27 Oct 2009 10:51:34 -0700 Subject: EXT-1727 Chat history widget has no context menu for copy/paste operations added ignore for dbghelp.dll reviewed by James --- .hgignore | 1 + indra/llui/lltexteditor.cpp | 36 ++++++++++++++- indra/llui/lltexteditor.h | 4 ++ .../skins/default/xui/en/menu_text_editor.xml | 54 ++++++++++++++++++++++ 4 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_text_editor.xml diff --git a/.hgignore b/.hgignore index eeb6d44996..8e02212e79 100644 --- a/.hgignore +++ b/.hgignore @@ -43,3 +43,4 @@ tarfile_tmp ^indra/web/dataservice/locale.* ^indra/web/dataservice/lib/shared/vault.* ^indra/web/dataservice/vendor.* +glob:indra/newview/dbghelp.dll 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 #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("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 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 @@ + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3