diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.cpp | 18 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.cpp | 78 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.h | 10 | ||||
-rw-r--r-- | indra/llui/llflatlistview.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 43 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 10 |
7 files changed, 109 insertions, 56 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index d7d411dee6..0a284f0088 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -85,6 +85,7 @@ set(llui_SOURCE_FILES lltextbox.cpp lltexteditor.cpp lltextparser.cpp + lltransientfloatermgr.cpp lltransutil.cpp lltooltip.cpp llui.cpp @@ -171,6 +172,7 @@ set(llui_HEADER_FILES lltexteditor.h lltextparser.h lltooltip.h + lltransientfloatermgr.h lltransutil.h lluicolortable.h lluiconstants.h diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 93d62fd7c2..4525f0a45b 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -71,9 +71,9 @@ void LLDockableFloater::resetInstance() if (sInstanceHandle.get() != NULL && sInstanceHandle.get()->isDocked()) { sInstanceHandle.get()->setVisible(FALSE); - } + } sInstanceHandle = getHandle(); - } + } } void LLDockableFloater::setVisible(BOOL visible) @@ -105,11 +105,11 @@ void LLDockableFloater::setDocked(bool docked, bool pop_on_undock) mDockControl.get()->off(); } - if (!docked && pop_on_undock) - { - // visually pop up a little bit to emphasize the undocking - translate(0, UNDOCK_LEAP_HEIGHT); - } + if (!docked && pop_on_undock) + { + // visually pop up a little bit to emphasize the undocking + translate(0, UNDOCK_LEAP_HEIGHT); + } } else { @@ -126,8 +126,8 @@ void LLDockableFloater::draw() mDockControl.get()->repositionDockable(); if (isDocked()) { - mDockControl.get()->drawToungue(); - } + mDockControl.get()->drawToungue(); + } } LLFloater::draw(); } diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index 0b16b2554c..146c7a969a 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -35,7 +35,7 @@ #include "lldockcontrol.h" LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, - const LLUIImagePtr& dockTongue, DocAt dockAt, get_rect_callback_t get_rect_callback) : + const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_allowed_rect_callback) : mDockWidget(dockWidget), mDockableFloater(dockableFloater), mDockTongue(dockTongue) { mDockAt = dockAt; @@ -49,13 +49,13 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, off(); } - if (!(get_rect_callback)) + if (!(get_allowed_rect_callback)) { - mGetRectCallback = boost::bind(&LLDockControl::getEnabledRect, this, _1); + mGetAllowedRectCallback = boost::bind(&LLDockControl::getAllowedRect, this, _1); } else { - mGetRectCallback = get_rect_callback; + mGetAllowedRectCallback = get_allowed_rect_callback; } if (dockWidget != NULL) @@ -77,7 +77,7 @@ void LLDockControl::setDock(LLView* dockWidget) } } -void LLDockControl::getEnabledRect(LLRect& rect) +void LLDockControl::getAllowedRect(LLRect& rect) { rect = mDockableFloater->getRootView()->getRect(); } @@ -86,7 +86,7 @@ void LLDockControl::repositionDockable() { LLRect dockRect = mDockWidget->calcScreenRect(); LLRect rootRect; - mGetRectCallback(rootRect); + mGetAllowedRectCallback(rootRect); static BOOL prev_visibility = !mDockWidget->getVisible(); // recalculate dockable position if dock position changed, dock visibility changed, @@ -100,7 +100,7 @@ void LLDockControl::repositionDockable() mDockableFloater->setDocked(false); // force off() since dockable may not have dockControll at this time off(); - } + } else { moveDockable(); @@ -123,10 +123,10 @@ bool LLDockControl::isDockVisible() res = mDockWidget->isInVisibleChain(); if (res) { - LLRect dockRect = mDockWidget->calcScreenRect(); + LLRect dockRect = mDockWidget->calcScreenRect(); switch (mDockAt) - { + { case TOP: // check is dock inside parent rect LLRect dockParentRect = @@ -149,25 +149,25 @@ void LLDockControl::moveDockable() // calculate new dockable position LLRect dockRect = mDockWidget->calcScreenRect(); LLRect rootRect; - mGetRectCallback(rootRect); + mGetAllowedRectCallback(rootRect); - LLRect dockableRect = mDockableFloater->calcScreenRect(); - S32 x = 0; - S32 y = 0; - switch (mDockAt) - { - case TOP: - x = dockRect.getCenterX() - dockableRect.getWidth() / 2; + LLRect dockableRect = mDockableFloater->calcScreenRect(); + S32 x = 0; + S32 y = 0; + switch (mDockAt) + { + case TOP: + x = dockRect.getCenterX() - dockableRect.getWidth() / 2; y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight(); // check is dockable inside root view rect - if (x < rootRect.mLeft) - { - x = rootRect.mLeft; - } - if (x + dockableRect.getWidth() > rootRect.mRight) - { - x = rootRect.mRight - dockableRect.getWidth(); - } + if (x < rootRect.mLeft) + { + x = rootRect.mLeft; + } + if (x + dockableRect.getWidth() > rootRect.mRight) + { + x = rootRect.mRight - dockableRect.getWidth(); + } // calculate dock tongue position @@ -185,21 +185,21 @@ void LLDockControl::moveDockable() { mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2; } - mDockTongueY = dockRect.mTop; + mDockTongueY = dockRect.mTop; - break; - } + break; + } // move dockable - dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(), - dockableRect.getHeight()); - LLRect localDocableParentRect; - mDockableFloater->getParent()->screenRectToLocal(dockableRect, - &localDocableParentRect); - mDockableFloater->setRect(localDocableParentRect); + 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->screenPointToLocal(mDockTongueX, mDockTongueY, + &mDockTongueX, &mDockTongueY); } @@ -207,9 +207,9 @@ void LLDockControl::on() { if (isDockVisible()) { - mDockableFloater->setCanDrag(false); - mEnabled = true; - mRecalculateDocablePosition = true; + mDockableFloater->setCanDrag(false); + mEnabled = true; + mRecalculateDocablePosition = true; } } diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index 219ddfd092..e8ffcac0ac 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -52,11 +52,11 @@ public: public: // callback for a function getting a rect valid for control's position - typedef boost::function<void (LLRect& )> get_rect_callback_t; + typedef boost::function<void (LLRect& )> get_allowed_rect_callback_t; LOG_CLASS(LLDockControl); LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, - const LLUIImagePtr& dockTongue, DocAt dockAt, get_rect_callback_t get_rect_callback = NULL); + const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_rect_callback = NULL); virtual ~LLDockControl(); public: @@ -67,13 +67,13 @@ public: void drawToungue(); bool isDockVisible(); - // gets a rect that bounds possible positions for a dockable control - void getEnabledRect(LLRect& rect); + // gets a rect that bounds possible positions for a dockable control (EXT-1111) + void getAllowedRect(LLRect& rect); private: virtual void moveDockable(); private: - get_rect_callback_t mGetRectCallback; + get_allowed_rect_callback_t mGetAllowedRectCallback; bool mEnabled; bool mRecalculateDocablePosition; DocAt mDockAt; diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 9fcd386c19..e9df361472 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -39,8 +39,8 @@ static const LLDefaultChildRegistry::Register<LLFlatListView> flat_list_view("flat_list_view"); -const LLSD SELECTED_EVENT = LLSD().insert("selected", true); -const LLSD UNSELECTED_EVENT = LLSD().insert("selected", false); +const LLSD SELECTED_EVENT = LLSD().insert("selected", true); +const LLSD UNSELECTED_EVENT = LLSD().insert("selected", false); static const std::string COMMENT_TEXTBOX = "comment_text"; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 8d5f277b59..39f09b297f 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2001,6 +2001,8 @@ void LLTextEditor::cut() deleteSelection( FALSE ); needsReflow(); + + onKeyStroke(); } BOOL LLTextEditor::canCopy() const @@ -2105,6 +2107,8 @@ void LLTextEditor::pasteHelper(bool is_primary) deselect(); needsReflow(); + + onKeyStroke(); } @@ -2492,6 +2496,8 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) if(text_may_have_changed) { needsReflow(); + + onKeyStroke(); } needsScroll(); } @@ -2534,6 +2540,8 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) deselect(); needsReflow(); + + onKeyStroke(); } return handled; @@ -2588,6 +2596,8 @@ void LLTextEditor::doDelete() setCursorPos(mCursorPos + 1); removeChar(); } + + onKeyStroke(); } needsReflow(); @@ -2634,6 +2644,8 @@ void LLTextEditor::undo() setCursorPos(pos); needsReflow(); + + onKeyStroke(); } BOOL LLTextEditor::canRedo() const @@ -2676,6 +2688,8 @@ void LLTextEditor::redo() setCursorPos(pos); needsReflow(); + + onKeyStroke(); } void LLTextEditor::onFocusReceived() @@ -4402,6 +4416,8 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, // Update of the preedit should be caused by some key strokes. mKeystrokeTimer.reset(); + + onKeyStroke(); } BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const @@ -4648,3 +4664,30 @@ void LLInlineViewSegment::linkToDocument(LLTextBase* editor) ed->addDocumentChild(mView); } } + +BOOL LLTextEditor::isDirty() const +{ + if(mReadOnly) + { + return FALSE; + } + + if( mPristineCmd ) + { + return ( mPristineCmd == mLastCmd ); + } + else + { + return ( NULL != mLastCmd ); + } +} + +void LLTextEditor::setKeystrokeCallback(const keystroke_signal_t::slot_type& callback) +{ + mKeystrokeSignal.connect(callback); +} + +void LLTextEditor::onKeyStroke() +{ + mKeystrokeSignal(this); +} diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 68b8f2c3b1..a04261c4be 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -139,6 +139,10 @@ public: virtual ~LLTextEditor(); + typedef boost::signals2::signal<void (LLTextEditor* caller)> keystroke_signal_t; + + void setKeystrokeCallback(const keystroke_signal_t::slot_type& callback); + void setParseHighlights(BOOL parsing) {mParseHighlights=parsing;} // mousehandler overrides @@ -169,7 +173,7 @@ public: virtual void clear(); virtual void setFocus( BOOL b ); virtual BOOL acceptsTextInput() const; - virtual BOOL isDirty() const { return isPristine(); } + virtual BOOL isDirty() const; virtual void setValue(const LLSD& value); // LLEditMenuHandler interface @@ -503,6 +507,8 @@ private: S32 getFirstVisibleLine() const; + void onKeyStroke(); + // // Data // @@ -568,6 +574,8 @@ private: BOOL mHandleEditKeysDirectly; LLCoordGL mLastIMEPosition; // Last position of the IME editor + + keystroke_signal_t mKeystrokeSignal; }; // end class LLTextEditor |