diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-08-12 01:12:27 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-08-12 01:12:27 +0000 |
commit | 0bf4b5f2222ffb8171be094613363427f3b8470a (patch) | |
tree | 4b742d6815f44a85c98113e9c5a3017eafc5968d /indra/newview/lllocationinputctrl.cpp | |
parent | 8d7e56f219d0915e2c4a19baf2809dbc6ede7fa5 (diff) |
merge https://svn.aws.productengine.com/secondlife/export-from-ll@1277 https://svn.aws.productengine.com/secondlife/pe/stable-1@1297 -> viewer-2-0
Fixes:
EXT 208 EXT 366 EXT-211 EXT-245 EXT-246 EXT-278 EXT-279 EXT-280 EXT-298 EXT-301 EXT-304 EXT-311 EXT-317 EXT-318 EXT-319 EXT-339 EXT-343 EXT-344 EXT-346 EXT-349 EXT-350 EXT-351 EXT-354 EXT-355 EXT-358 EXT-360 EXT-362 EXT-369 EXT-372 EXT-374 EXT-381 EXT-382 EXT-383 EXT-395 EXT-396 EXT-412
Other changes:
Movement & Caemra controls work
Profile and Me panel refactoring
Notification refactoring
Diffstat (limited to 'indra/newview/lllocationinputctrl.cpp')
-rw-r--r-- | indra/newview/lllocationinputctrl.cpp | 64 |
1 files changed, 47 insertions, 17 deletions
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 7986d7c861..e2dc7d69a1 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -55,7 +55,7 @@ #include "llviewerinventory.h" #include "llviewerparcelmgr.h" #include "llviewercontrol.h" - +#include "llurllineeditorctrl.h" //============================================================================ /* * "ADD LANDMARK" BUTTON UPDATING LOGIC @@ -163,12 +163,38 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) mInfoBtn(NULL), mAddLandmarkBtn(NULL) { + // Lets replace default LLLineEditor with LLLocationLineEditor + // to make needed escaping while copying and cutting url + this->removeChild(mTextEntry); + delete mTextEntry; + + // Can't access old mTextEntry fields as they are protected, so lets build new params + // That is C&P from LLComboBox::createLineEditor function + static LLUICachedControl<S32> drop_shadow_button ("DropShadowButton", 0); + S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0; + LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); + text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * drop_shadow_button; + + LLLineEditor::Params params = p.combo_editor; + params.rect(text_entry_rect); + params.default_text(LLStringUtil::null); + params.max_length_bytes(p.max_chars); + params.commit_callback.function(boost::bind(&LLComboBox::onTextCommit, this, _2)); + params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1)); + params.focus_lost_callback(NULL); + params.handle_edit_keys_directly(true); + params.commit_on_focus_lost(false); + params.follows.flags(FOLLOWS_ALL); + mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params); + this->addChild(mTextEntry); + // LLLineEditor is replaced with LLLocationLineEditor + // "Place information" button. LLButton::Params info_params = p.info_button; mInfoBtn = LLUICtrlFactory::create<LLButton>(info_params); mInfoBtn->setClickedCallback(boost::bind(&LLLocationInputCtrl::onInfoButtonClicked, this)); addChild(mInfoBtn); - + // "Add landmark" button. LLButton::Params al_params = p.add_landmark_button; if (p.add_landmark_image_enabled()) @@ -187,6 +213,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) addChild(mAddLandmarkBtn); setPrearrangeCallback(boost::bind(&LLLocationInputCtrl::onLocationPrearrange, this, _2)); + getTextEntry()->setMouseUpCallback(boost::bind(&LLLocationInputCtrl::onTextEditorMouseUp, this, _2,_3,_4)); updateWidgetlayout(); @@ -234,24 +261,20 @@ BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* // Let the buttons show their tooltips. if (LLUICtrl::handleToolTip(x, y, msg, sticky_rect_screen) && !msg.empty()) { - LLLocationHistory* lh = LLLocationHistory::getInstance(); - const std::string tooltip = lh->getToolTip(msg); + if (mList->getRect().pointInRect(x, y)) { + LLLocationHistory* lh = LLLocationHistory::getInstance(); + const std::string tooltip = lh->getToolTip(msg); - if (!tooltip.empty()) { - msg = tooltip; + if (!tooltip.empty()) { + msg = tooltip; + } } return TRUE; } - // Cursor is above the text entry. msg = LLUI::sShowXUINames ? getShowNamesToolTip() : ""; - if (mTextEntry && sticky_rect_screen) - { - *sticky_rect_screen = mTextEntry->calcScreenRect(); - } - - return TRUE; + return mTextEntry->getRect().pointInRect(x, y); } BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask) @@ -328,19 +351,19 @@ void LLLocationInputCtrl::handleLoginComplete() void LLLocationInputCtrl::onFocusReceived() { prearrangeList(); - setText(gAgent.getSLURL()); - if (mTextEntry) - mTextEntry->endSelection(); // we don't want handleMouseUp() to "finish" the selection } void LLLocationInputCtrl::onFocusLost() { LLUICtrl::onFocusLost(); refreshLocation(); + if(mTextEntry->hasSelection()){ + mTextEntry->deselect(); + } } void LLLocationInputCtrl::draw(){ - if(!hasFocus()){ + if(!hasFocus() && gSavedSettings.getBOOL("ShowCoordinatesOption")){ refreshLocation(); } LLComboBox::draw(); @@ -378,6 +401,13 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) rebuildLocationHistory(filter); mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item. } +void LLLocationInputCtrl::onTextEditorMouseUp(S32 x, S32 y, MASK mask) +{ + if (!mTextEntry->hasSelection()) { + setText(gAgent.getUnescapedSLURL()); + mTextEntry->selectAll(); + } +} void LLLocationInputCtrl::refresh() { |