diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llui/llbutton.cpp | 18 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 6 | ||||
-rw-r--r-- | indra/llui/llclipboard.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llclipboard.h | 1 | ||||
-rw-r--r-- | indra/llui/llfiltereditor.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llfiltereditor.h | 1 | ||||
-rw-r--r-- | indra/llui/llfocusmgr.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 11 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 11 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lltextbox.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lluictrl.cpp | 23 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 18 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 2 |
16 files changed, 93 insertions, 31 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index edd3fe2beb..e8d95b44a5 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -48,6 +48,7 @@ set(llui_SOURCE_FILES llkeywords.cpp lllayoutstack.cpp lllineeditor.cpp + lllink.cpp llmenugl.cpp llmodaldialog.cpp llmultifloater.cpp @@ -125,6 +126,7 @@ set(llui_HEADER_FILES lllayoutstack.h lllazyvalue.h lllineeditor.h + lllink.h llmenugl.h llmodaldialog.h llmultifloater.h diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index ac368fd785..c566282bef 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -64,6 +64,7 @@ LLButton::Params::Params() : label_selected("label_selected"), // requires is_toggle true label_shadow("label_shadow", true), auto_resize("auto_resize", false), + use_ellipses("use_ellipses", false), image_unselected("image_unselected"), image_selected("image_selected"), image_hover_selected("image_hover_selected"), @@ -138,6 +139,7 @@ LLButton::LLButton(const LLButton::Params& p) mScaleImage(p.scale_image), mDropShadowedText(p.label_shadow), mAutoResize(p.auto_resize), + mUseEllipses( p.use_ellipses ), mHAlign(p.font_halign), mLeftHPad(p.pad_left), mRightHPad(p.pad_right), @@ -280,11 +282,6 @@ boost::signals2::connection LLButton::setHeldDownCallback( const commit_signal_t { return mHeldDownSignal.connect(cb); } - -boost::signals2::connection LLButton::setRightClickedCallback( const commit_signal_t::slot_type& cb ) -{ - return mRightClickSignal.connect(cb); -} // *TODO: Deprecate (for backwards compatability only) @@ -437,7 +434,7 @@ BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) if (pointInView(x, y)) { - mRightClickSignal(this, getValue()); + mRightClickSignal(this, x,y,mask); } } else @@ -780,13 +777,18 @@ void LLButton::draw() x++; } + // *NOTE: mantipov: before mUseEllipses is implemented in EXT-279 U32_MAX has been passed as + // max_chars. + // LLFontGL::render expects S32 max_chars variable but process in a separate way -1 value. + // Due to U32_MAX is equal to S32 -1 value I have rest this value for non-ellipses mode. + // Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars. mGLFont->render(label, 0, (F32)x, (F32)(LLBUTTON_V_PAD + y_offset), label_color, mHAlign, LLFontGL::BOTTOM, LLFontGL::NORMAL, mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW, - U32_MAX, text_width, - NULL, FALSE, FALSE); + S32_MAX, text_width, + NULL, FALSE, mUseEllipses); } LLUICtrl::draw(); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 93e0414a02..249882013a 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -76,6 +76,7 @@ public: Optional<std::string> label_selected; Optional<bool> label_shadow; Optional<bool> auto_resize; + Optional<bool> use_ellipses; // images Optional<LLUIImage*> image_unselected, @@ -152,14 +153,14 @@ public: void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; } void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; } + void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } + boost::signals2::connection setClickedCallback( const commit_signal_t::slot_type& cb ); // mouse down and up within button boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); // mouse up, EVEN IF NOT IN BUTTON // Passes a 'count' parameter in the commit param payload, i.e. param["count"]) boost::signals2::connection setHeldDownCallback( const commit_signal_t::slot_type& cb ); // Mouse button held down and in button - boost::signals2::connection setRightClickedCallback( const commit_signal_t::slot_type& cb ); // right mouse down and up within button - // *TODO: Deprecate (for backwards compatability only) @@ -297,6 +298,7 @@ private: BOOL mDropShadowedText; BOOL mAutoResize; + BOOL mUseEllipses; BOOL mBorderEnabled; BOOL mFlashing; diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 2cb8197a67..cbd4cb380f 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -61,6 +61,12 @@ void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, cons LLView::getWindow()->copyTextToClipboard( mString ); } +void LLClipboard::copyFromString(const LLWString &src, const LLUUID& source_id ) +{ + mSourceID = source_id; + mString = src; + LLView::getWindow()->copyTextToClipboard( mString ); +} const LLWString& LLClipboard::getPasteWString( LLUUID* source_id ) { diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 034a7a6aeb..d7ffeb33e0 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -50,6 +50,7 @@ public: (i.e. X11/Linux). */ void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); + void copyFromString(const LLWString ©_from, const LLUUID& source_id = LLUUID::null ); BOOL canPasteString() const; const LLWString& getPasteWString(LLUUID* source_id = NULL); diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp index 0f36483fc2..7d6a4007a2 100644 --- a/indra/llui/llfiltereditor.cpp +++ b/indra/llui/llfiltereditor.cpp @@ -87,6 +87,12 @@ BOOL LLFilterEditor::setLabelArg( const std::string& key, const LLStringExplicit } //virtual +void LLFilterEditor::setLabel( const LLStringExplicit &new_label ) +{ + mFilterEditor->setLabel(new_label); +} + +//virtual void LLFilterEditor::clear() { if (mFilterEditor) diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h index 4240fd770c..fceb82af8d 100644 --- a/indra/llui/llfiltereditor.h +++ b/indra/llui/llfiltereditor.h @@ -74,6 +74,7 @@ public: virtual LLSD getValue() const; virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual void setLabel( const LLStringExplicit &new_label ); virtual void clear(); private: diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 3fef215661..3899897c5f 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -131,7 +131,9 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystroke // call onFocusLost on all remaining in the old focus list while (old_focus_iter != mCachedKeyboardFocusList.end()) { - old_focus_iter->get()->onFocusLost(); + if (old_focus_iter->get() != NULL) { + old_focus_iter->get()->onFocusLost(); + } old_focus_iter++; } diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 02ee567803..20957499bc 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -623,6 +623,8 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) // delay cursor flashing mKeystrokeTimer.reset(); + + LLUICtrl::handleMouseDown(x,y,mask); return TRUE; } @@ -736,7 +738,9 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) // take selection to 'primary' clipboard updatePrimary(); } - + + // We won't call LLUICtrl::handleMouseUp to avoid double calls of childrenHandleMouseUp().Just invoke the signal manually. + mMouseUpSignal(this,x,y, mask); return handled; } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index e355cfda8b..e5c32846a0 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -176,6 +176,12 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) std::string key_str = shortcut.substr(pipe_pos+1); LLKeyboard::keyFromString(key_str, &mAcceleratorKey); + + LL_DEBUGS("HotKeys") << "Process short cut key: shortcut: " << shortcut + << ", key str: " << key_str + << ", accelerator mask: " << mAcceleratorMask + << ", accelerator key: " << mAcceleratorKey + << LL_ENDL; } BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask) @@ -285,6 +291,7 @@ void LLMenuItemGL::appendAcceleratorString( std::string& st ) const st.append( " " ); } st.append( keystr ); + LL_DEBUGS("HotKeys") << "appendAcceleratorString: " << st << LL_ENDL; } void LLMenuItemGL::setJumpKey(KEY key) @@ -797,7 +804,7 @@ BOOL LLMenuItemCallGL::handleRightMouseUp(S32 x, S32 y, MASK mask) { if (pointInView(x, y)) { - mRightClickSignal(this, getValue()); + mRightClickSignal(this,x,y, mask); } return TRUE; @@ -2996,6 +3003,7 @@ BOOL LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) return LLMenuGL::handleMouseDown(x, y, mask); } +/* BOOL LLMenuBarGL::handleRightMouseDown(S32 x, S32 y, MASK mask) { // clicks on menu bar closes existing menus from other contexts but leave @@ -3007,6 +3015,7 @@ BOOL LLMenuBarGL::handleRightMouseDown(S32 x, S32 y, MASK mask) return LLMenuGL::handleMouseDown(x, y, mask); } +*/ void LLMenuBarGL::draw() diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 828956a217..930276f7bc 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -297,10 +297,6 @@ public: return mEnableSignal.connect(cb); } - boost::signals2::connection setRightClickedCallback( const commit_signal_t::slot_type& cb ) - { - return mRightClickSignal.connect(cb); - } private: enable_signal_t mEnableSignal; @@ -492,9 +488,6 @@ public: void buildDrawLabels(); void createJumpKeys(); - // Show popup in global screen space based on last mouse location. - static void showPopup(LLMenuGL* menu); - // Show popup at a specific location. static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y); @@ -716,7 +709,9 @@ public: /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ BOOL handleJumpKey(KEY key); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); +// /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + + /*virtual*/ void draw(); /*virtual*/ BOOL jumpKeysActive(); diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 79f0f9d71b..3041773fb2 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1684,7 +1684,8 @@ BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) // so the scroll bars will work. if (NULL == LLView::childrenHandleDoubleClick(x, y, mask)) { - if( mCanSelect && mOnDoubleClickCallback ) + // Run the callback only if an item is being double-clicked. + if( mCanSelect && hitItem(x, y) && mOnDoubleClickCallback ) { mOnDoubleClickCallback(); } diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 3dd8d21f6b..f9bcb685b8 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -32,12 +32,18 @@ #include "linden_common.h" #include "lltextbox.h" +#include "lllink.h" #include "lluictrlfactory.h" #include "llfocusmgr.h" #include "llwindow.h" static LLDefaultChildRegistry::Register<LLTextBox> r("text"); +//*NOTE +// LLLink is not used in code for now, therefor Visual Studio doesn't build it. +// "link" is registered here to force Visual Studio to build LLLink class. +static LLDefaultChildRegistry::Register<LLLink> register_link("link"); + LLTextBox::Params::Params() : text_color("text_color"), length("length"), diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 19d1d4040c..8aa7540446 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -47,7 +47,6 @@ LLUICtrl::Params::Params() init_callback("init_callback"), commit_callback("commit_callback"), validate_callback("validate_callback"), - rightclick_callback("rightclick_callback"), mouseenter_callback("mouseenter_callback"), mouseleave_callback("mouseleave_callback"), control_name("control_name") @@ -199,9 +198,6 @@ void LLUICtrl::initFromParams(const Params& p) } } - if(p.rightclick_callback.isProvided()) - initCommitCallback(p.rightclick_callback, mRightClickSignal); - if(p.mouseenter_callback.isProvided()) initCommitCallback(p.mouseenter_callback, mMouseEnterSignal); @@ -282,7 +278,24 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask) { mMouseLeaveSignal(this, getValue()); } - +//virtual +BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask){ + BOOL handled = LLView::handleMouseDown(x,y,mask); + mMouseDownSignal(this,x,y,mask); + return handled; +} +//virtual +BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask){ + BOOL handled = LLView::handleMouseUp(x,y,mask); + mMouseUpSignal(this,x,y,mask); + return handled; +} +//virtual +BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask){ + BOOL handled = LLView::handleRightMouseUp(x,y,mask); + mRightClickSignal(this,x,y,mask); + return handled; +} void LLUICtrl::onCommit() { mCommitSignal(this, getValue()); diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index cf6634f370..6ba3b01fcb 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -81,6 +81,8 @@ public: typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> commit_callback_t; typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t; + // *TODO: add xml support for this type of signal in the future + typedef boost::signals2::signal<void (LLUICtrl* ctrl, S32 x, S32 y, MASK mask)> mouse_signal_t; typedef boost::function<bool (LLUICtrl* ctrl, const LLSD& param)> enable_callback_t; typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t; @@ -144,8 +146,6 @@ public: commit_callback; Optional<EnableCallbackParam> validate_callback; - Optional<CommitCallbackParam> rightclick_callback; - Optional<CommitCallbackParam> mouseenter_callback; Optional<CommitCallbackParam> mouseleave_callback; @@ -186,6 +186,9 @@ public: /*virtual*/ BOOL getTentative() const; /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); // From LLFocusableElement /*virtual*/ void setFocus( BOOL b ); @@ -253,6 +256,10 @@ public: boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mMouseEnterSignal.connect(cb); } boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mMouseLeaveSignal.connect(cb); } + boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); } + boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); } + boost::signals2::connection setRightClickedCallback( const mouse_signal_t::slot_type& cb ) { return mRightClickSignal.connect(cb); } + // *TODO: Deprecate; for backwards compatability only: boost::signals2::connection setCommitCallback( boost::function<void (LLUICtrl*,void*)> cb, void* data); boost::signals2::connection setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb ); @@ -279,11 +286,14 @@ protected: commit_signal_t mCommitSignal; enable_signal_t mValidateSignal; - commit_signal_t mRightClickSignal; commit_signal_t mMouseEnterSignal; commit_signal_t mMouseLeaveSignal; - + + mouse_signal_t mMouseDownSignal; + mouse_signal_t mMouseUpSignal; + mouse_signal_t mRightClickSignal; + LLViewModelPtr mViewModel; LLControlVariable* mControlVariable; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d94472a8e5..e3b61dfaa2 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -75,6 +75,8 @@ S32 LLView::sLastBottomXML = S32_MIN; BOOL LLView::sIsDrawing = FALSE; #endif +static LLDefaultChildRegistry::Register<LLView> r("view"); + LLView::Params::Params() : name("name", std::string("unnamed")), enabled("enabled", true), |