From f763033db29a19bd58cbb2c595c9a76096888211 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 15 Feb 2010 17:44:32 +0000 Subject: CID-87 Checker: FORWARD_NULL Function: LLLocationInputCtrl::refreshLocation() File: /indra/newview/lllocationinputctrl.cpp --- indra/newview/lllocationinputctrl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index f48c96190f..c66d067779 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -833,10 +833,13 @@ void LLLocationInputCtrl::refreshParcelIcons() mDamageText->setVisible(false); } - S32 left_pad, right_pad; - mTextEntry->getTextPadding(&left_pad, &right_pad); - right_pad = mTextEntry->getRect().mRight - x; - mTextEntry->setTextPadding(left_pad, right_pad); + if (mTextEntry) + { + S32 left_pad, right_pad; + mTextEntry->getTextPadding(&left_pad, &right_pad); + right_pad = mTextEntry->getRect().mRight - x; + mTextEntry->setTextPadding(left_pad, right_pad); + } } void LLLocationInputCtrl::refreshHealth() -- cgit v1.3 From 5e26566f486611a49454cd83b0dd7f2dbad20d8b Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 18 Feb 2010 19:13:14 +0200 Subject: Fixed low bug (EXT-5212) Add "Parcel Properties" and "Coordinates" to World->Show. --HG-- branch : product-engine --- indra/newview/lllocationinputctrl.cpp | 20 +++++++++++++++++--- indra/newview/lllocationinputctrl.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index c66d067779..e493c4bf9c 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -358,6 +358,20 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) getTextEntry()->setRightMouseUpCallback(boost::bind(&LLLocationInputCtrl::onTextEditorRightClicked,this,_2,_3,_4)); updateWidgetlayout(); + // Connecting signal for updating location on "Show Coordinates" setting change. + LLControlVariable* coordinates_control = gSavedSettings.getControl("NavBarShowCoordinates").get(); + if (coordinates_control) + { + mCoordinatesControlConnection = coordinates_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshLocation, this)); + } + + // Connecting signal for updating parcel icons on "Show Parcel Properties" setting change. + LLControlVariable* parcel_properties_control = gSavedSettings.getControl("NavBarShowParcelProperties").get(); + if (parcel_properties_control) + { + mParcelPropertiesControlConnection = parcel_properties_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshParcelIcons, this)); + } + // - Make the "Add landmark" button updated when either current parcel gets changed // or a landmark gets created or removed from the inventory. // - Update the location string on parcel change. @@ -391,6 +405,8 @@ LLLocationInputCtrl::~LLLocationInputCtrl() LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangeObserver); delete mParcelChangeObserver; + mCoordinatesControlConnection.disconnect(); + mParcelPropertiesControlConnection.disconnect(); mParcelMgrConnection.disconnect(); mLocationHistoryConnection.disconnect(); } @@ -763,8 +779,7 @@ void LLLocationInputCtrl::refreshParcelIcons() // Our "cursor" moving right to left S32 x = mAddLandmarkBtn->getRect().mLeft; - static LLUICachedControl show_properties("NavBarShowParcelProperties", false); - if (show_properties) + if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) { LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); @@ -1008,7 +1023,6 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata) { gSavedSettings.setBOOL("NavBarShowParcelProperties", !gSavedSettings.getBOOL("NavBarShowParcelProperties")); - refreshParcelIcons(); } else if (item == "landmark") { diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index caa62daa1b..4bb41f3bf4 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -174,6 +174,8 @@ private: LLRemoveLandmarkObserver* mRemoveLandmarkObserver; LLParcelChangeObserver* mParcelChangeObserver; + boost::signals2::connection mCoordinatesControlConnection; + boost::signals2::connection mParcelPropertiesControlConnection; boost::signals2::connection mParcelMgrConnection; boost::signals2::connection mLocationHistoryConnection; LLUIImage* mLandmarkImageOn; -- cgit v1.3 From 6a3ea6fa610bdaf7fb6aa6aa4304e20f2536cde5 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Fri, 19 Feb 2010 18:47:21 +0200 Subject: no ticket. minor changes. Comments cleaning up. The logic was NOT changed. --HG-- branch : product-engine --- indra/newview/lllocationhistory.h | 10 ++++++---- indra/newview/lllocationinputctrl.cpp | 4 ++-- indra/newview/llnavigationbar.cpp | 16 +++++++++++----- 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationhistory.h b/indra/newview/lllocationhistory.h index 5f9976f87a..65f0dd2e1b 100644 --- a/indra/newview/lllocationhistory.h +++ b/indra/newview/lllocationhistory.h @@ -41,11 +41,13 @@ #include class LLSD; - +/** + * This enum is responsible for identifying of history item. + */ enum ELocationType { - TYPED_REGION_SURL//region name or surl - ,LANDMARK // name of landmark - ,TELEPORT_HISTORY + TYPED_REGION_SLURL//item added after the user had typed a region name or slurl + ,LANDMARK // item has been loaded from landmark folder + ,TELEPORT_HISTORY // item from session teleport history }; class LLLocationHistoryItem { diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index e493c4bf9c..04c684b240 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -664,7 +664,7 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) value["item_type"] = TELEPORT_HISTORY; value["global_pos"] = result->mGlobalPos.getValue(); std::string region_name = result->mTitle.substr(0, result->mTitle.find(',')); - //TODO*: add Surl to teleportitem or parse region name from title + //TODO*: add slurl to teleportitem or parse region name from title value["tooltip"] = LLSLURL::buildSLURLfromPosGlobal(region_name, result->mGlobalPos, false); add(result->getTitle(), value); @@ -914,7 +914,7 @@ void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) LLSD value; value["tooltip"] = it->getToolTip(); //location history can contain only typed locations - value["item_type"] = TYPED_REGION_SURL; + value["item_type"] = TYPED_REGION_SLURL; value["global_pos"] = it->mGlobalPos.getValue(); add(it->getLocation(), value); } diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index f022bfeb4f..d42e4bc250 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -449,8 +449,14 @@ void LLNavigationBar::onLocationSelection() // Will not teleport to empty location. if (typed_location.empty()) return; - + //get selected item from combobox item LLSD value = mCmbLocation->getSelectedValue(); + /* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item, + * typed by user slurl or region name. Let's find out which type of item the user has selected + * to make decision about adding this location into typed history. see mSaveToLocationHistory + * Note: + * Only TYPED_REGION_SLURL item will be added into LLLocationHistory + */ if(value.has("item_type")) { @@ -480,7 +486,7 @@ void LLNavigationBar::onLocationSelection() case TELEPORT_HISTORY: //in case of teleport item was selected, teleport by position too. - case TYPED_REGION_SURL: + case TYPED_REGION_SLURL: if(value.has("global_pos")) { gAgent.teleportViaLocation(LLVector3d(value["global_pos"])); @@ -492,7 +498,7 @@ void LLNavigationBar::onLocationSelection() break; } } - //Let's parse surl or region name + //Let's parse slurl or region name std::string region_name; LLVector3 local_coords(128, 128, 0); @@ -541,7 +547,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos) return; LLLocationHistory* lh = LLLocationHistory::getInstance(); - //TODO*: do we need convert surl into readable format? + //TODO*: do we need convert slurl into readable format? std::string location; /*NOTE: * We can't use gAgent.getPositionAgent() in case of local teleport to build location. @@ -553,7 +559,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos) std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false)); LLLocationHistoryItem item (location, - global_agent_pos, tooltip,TYPED_REGION_SURL);// we can add into history only TYPED location + global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location //Touch it, if it is at list already, add new location otherwise if ( !lh->touchItem(item) ) { lh->addItem(item); -- cgit v1.3 From 09053688c3b35b7c4e33ed831b806220a77ce662 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Mon, 22 Feb 2010 16:50:31 +0200 Subject: fixed low Bug EXT-5194 SLURL field dropdown should display empty menu rather than do nothing when empty --HG-- branch : product-engine --- indra/newview/lllocationinputctrl.cpp | 9 +++++++++ indra/newview/lllocationinputctrl.h | 7 +++++++ 2 files changed, 16 insertions(+) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 04c684b240..a9ead36a70 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -674,6 +674,15 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) _1, filter)); } } + if(mList->isEmpty()) + { + /** + * Add a couple of empty items for a better view. + * EXT-5194 + */ + for(int i = 0; i < NUMBER_OF_EMPTY_ITEMS; i++ ) + add("", LLSD()); + } sortByName(); mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item. diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 4bb41f3bf4..ee128a5cf7 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -120,6 +120,13 @@ private: ICON_COUNT }; + /** + * This constant holds number of empty dropdown items, which will be displayed instead of doing nothing when the list is empty. + * Added due to EXT-5194 + */ + static const S32 NUMBER_OF_EMPTY_ITEMS = 3; + + friend class LLUICtrlFactory; LLLocationInputCtrl(const Params&); virtual ~LLLocationInputCtrl(); -- cgit v1.3 From ef5e9472d3e767b32d807cb178e99d7117455b24 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Tue, 23 Feb 2010 16:57:39 +0200 Subject: Fixed normal bug (EXT-5554) 'Land for Sale' icon should always be visible. - Made 'Land for Sale' icon visible in Navigation bar even if "Show Parcel Properties" is off. --HG-- branch : product-engine --- indra/newview/lllocationinputctrl.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index a9ead36a70..f8f9ea7379 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -788,15 +788,19 @@ void LLLocationInputCtrl::refreshParcelIcons() // Our "cursor" moving right to left S32 x = mAddLandmarkBtn->getRect().mLeft; - if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) - { - LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + + LLViewerRegion* agent_region = gAgent.getRegion(); + LLParcel* agent_parcel = vpm->getAgentParcel(); + if (!agent_region || !agent_parcel) + return; + + mForSaleBtn->setVisible(vpm->canAgentBuyParcel(agent_parcel, false)); - LLViewerRegion* agent_region = gAgent.getRegion(); - LLParcel* agent_parcel = vpm->getAgentParcel(); - if (!agent_region || !agent_parcel) - return; + x = layout_widget(mForSaleBtn, x); + if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) + { LLParcel* current_parcel; LLViewerRegion* selection_region = vpm->getSelectionRegion(); LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel(); @@ -816,7 +820,6 @@ void LLLocationInputCtrl::refreshParcelIcons() current_parcel = agent_parcel; } - bool allow_buy = vpm->canAgentBuyParcel(current_parcel, false); bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel); bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel); bool allow_push = vpm->allowAgentPush(agent_region, current_parcel); @@ -825,7 +828,6 @@ void LLLocationInputCtrl::refreshParcelIcons() bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel); // Most icons are "block this ability" - mForSaleBtn->setVisible(allow_buy); mParcelIcon[VOICE_ICON]->setVisible( !allow_voice ); mParcelIcon[FLY_ICON]->setVisible( !allow_fly ); mParcelIcon[PUSH_ICON]->setVisible( !allow_push ); @@ -833,11 +835,10 @@ void LLLocationInputCtrl::refreshParcelIcons() mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage ); mDamageText->setVisible(allow_damage); - - x = layout_widget(mForSaleBtn, x); + // Padding goes to left of both landmark star and for sale btn x -= mAddLandmarkHPad; - + // Slide the parcel icons rect from right to left, adjusting rectangles for (S32 i = 0; i < ICON_COUNT; ++i) { @@ -849,7 +850,6 @@ void LLLocationInputCtrl::refreshParcelIcons() } else { - mForSaleBtn->setVisible(false); for (S32 i = 0; i < ICON_COUNT; ++i) { mParcelIcon[i]->setVisible(false); -- cgit v1.3 From 887d03e55fe0a2086b21f401f74908c395749660 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Wed, 24 Feb 2010 15:02:18 +0200 Subject: back out a fix for EXT-5194 at changeset a577d1cad9ff --HG-- branch : product-engine --- indra/newview/lllocationinputctrl.cpp | 9 --------- indra/newview/lllocationinputctrl.h | 7 ------- 2 files changed, 16 deletions(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index a9ead36a70..04c684b240 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -674,15 +674,6 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) _1, filter)); } } - if(mList->isEmpty()) - { - /** - * Add a couple of empty items for a better view. - * EXT-5194 - */ - for(int i = 0; i < NUMBER_OF_EMPTY_ITEMS; i++ ) - add("", LLSD()); - } sortByName(); mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item. diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index ee128a5cf7..4bb41f3bf4 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -120,13 +120,6 @@ private: ICON_COUNT }; - /** - * This constant holds number of empty dropdown items, which will be displayed instead of doing nothing when the list is empty. - * Added due to EXT-5194 - */ - static const S32 NUMBER_OF_EMPTY_ITEMS = 3; - - friend class LLUICtrlFactory; LLLocationInputCtrl(const Params&); virtual ~LLLocationInputCtrl(); -- cgit v1.3 From 280671ce4ad1d2a352acdcd91746dd6382be5ff2 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Wed, 24 Feb 2010 18:26:16 +0200 Subject: Fixed major bug (EXT-5657) Location input becomes empty if press Ctrl+C. - Added check for pressed Ctrl button. --HG-- branch : product-engine --- indra/newview/lllocationinputctrl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index bdd4426636..5f233bece0 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -473,6 +473,7 @@ BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask) void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor) { KEY key = gKeyboard->currentKey(); + MASK mask = gKeyboard->currentMask(TRUE); if (line_editor->getText().empty()) { @@ -480,7 +481,7 @@ void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor) hideList(); } // Typing? (moving cursor should not affect showing the list) - else if (key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END) + else if (mask != MASK_CONTROL && key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END) { prearrangeList(line_editor->getText()); if (mList->getItemCount() != 0) -- cgit v1.3 From e235e71b907d7fa4d6bd15852e0a3eae3cbd07c5 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Thu, 25 Feb 2010 19:15:59 +0200 Subject: Bug Low EXT-5194 SLURL field dropdown should display empty menu rather than do nothing when empty Solution: Button of dropdown list will be disabled if there are no items in location history --HG-- branch : product-engine --- indra/newview/lllocationhistory.cpp | 8 +++++--- indra/newview/lllocationhistory.h | 17 ++++++++++++----- indra/newview/lllocationinputctrl.cpp | 18 +++++++++++------- indra/newview/lllocationinputctrl.h | 5 +++-- indra/newview/llnavigationbar.cpp | 6 ++++++ 5 files changed, 37 insertions(+), 17 deletions(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp index df93930d33..7906d9b20f 100644 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -63,6 +63,7 @@ void LLLocationHistory::addItem(const LLLocationHistoryItem& item) { mItems.erase(mItems.begin(), mItems.end()-max_items); } llassert((S32)mItems.size() <= max_items); + mChangedSignal(ADD); } /* @@ -87,9 +88,10 @@ bool LLLocationHistory::touchItem(const LLLocationHistoryItem& item) { void LLLocationHistory::removeItems() { mItems.clear(); + mChangedSignal(CLEAR); } -bool LLLocationHistory::getMatchingItems(std::string substring, location_list_t& result) const +bool LLLocationHistory::getMatchingItems(const std::string& substring, location_list_t& result) const { // *TODO: an STL algorithm would look nicer result.clear(); @@ -160,7 +162,7 @@ void LLLocationHistory::load() return; } - removeItems(); + mItems.clear();// need to use a direct call of clear() method to avoid signal invocation // add each line in the file to the list std::string line; @@ -179,5 +181,5 @@ void LLLocationHistory::load() file.close(); - mLoadedSignal(); + mChangedSignal(LOAD); } diff --git a/indra/newview/lllocationhistory.h b/indra/newview/lllocationhistory.h index 65f0dd2e1b..fb71fbaa0f 100644 --- a/indra/newview/lllocationhistory.h +++ b/indra/newview/lllocationhistory.h @@ -111,9 +111,16 @@ class LLLocationHistory: public LLSingleton LOG_CLASS(LLLocationHistory); public: + enum EChangeType + { + ADD + ,CLEAR + ,LOAD + }; + typedef std::vector location_list_t; - typedef boost::function loaded_callback_t; - typedef boost::signals2::signal loaded_signal_t; + typedef boost::function history_changed_callback_t; + typedef boost::signals2::signal history_changed_signal_t; LLLocationHistory(); @@ -122,8 +129,8 @@ public: void removeItems(); size_t getItemCount() const { return mItems.size(); } const location_list_t& getItems() const { return mItems; } - bool getMatchingItems(std::string substring, location_list_t& result) const; - boost::signals2::connection setLoadedCallback(loaded_callback_t cb) { return mLoadedSignal.connect(cb); } + bool getMatchingItems(const std::string& substring, location_list_t& result) const; + boost::signals2::connection setChangedCallback(history_changed_callback_t cb) { return mChangedSignal.connect(cb); } void save() const; void load(); @@ -133,7 +140,7 @@ private: location_list_t mItems; std::string mFilename; /// File to store the history to. - loaded_signal_t mLoadedSignal; + history_changed_signal_t mChangedSignal; }; #endif diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 5f233bece0..0ea4b1f6da 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -52,7 +52,6 @@ #include "llinventoryobserver.h" #include "lllandmarkactions.h" #include "lllandmarklist.h" -#include "lllocationhistory.h" #include "llteleporthistory.h" #include "llsidetray.h" #include "llslurl.h" @@ -377,9 +376,10 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) // - Update the location string on parcel change. mParcelMgrConnection = LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( boost::bind(&LLLocationInputCtrl::onAgentParcelChange, this)); - - mLocationHistoryConnection = LLLocationHistory::getInstance()->setLoadedCallback( - boost::bind(&LLLocationInputCtrl::onLocationHistoryLoaded, this)); + // LLLocationHistory instance is being created before the location input control, so we have to update initial state of button manually. + mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0); + mLocationHistoryConnection = LLLocationHistory::getInstance()->setChangedCallback( + boost::bind(&LLLocationInputCtrl::onLocationHistoryChanged, this,_1)); mRemoveLandmarkObserver = new LLRemoveLandmarkObserver(this); mAddLandmarkObserver = new LLAddLandmarkObserver(this); @@ -620,9 +620,13 @@ void LLLocationInputCtrl::onLandmarkLoaded(LLLandmark* lm) updateAddLandmarkButton(); } -void LLLocationInputCtrl::onLocationHistoryLoaded() +void LLLocationInputCtrl::onLocationHistoryChanged(LLLocationHistory::EChangeType event) { - rebuildLocationHistory(); + if(event == LLLocationHistory::LOAD) + { + rebuildLocationHistory(); + } + mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0); } void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) @@ -893,7 +897,7 @@ void LLLocationInputCtrl::positionMaturityIcon() mMaturityIcon->setVisible(rect.mRight < mTextEntry->getRect().getWidth() - right_pad); } -void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) +void LLLocationInputCtrl::rebuildLocationHistory(const std::string& filter) { LLLocationHistory::location_list_t filtered_items; const LLLocationHistory::location_list_t* itemsp = NULL; diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 4bb41f3bf4..dac6be2a24 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -36,6 +36,7 @@ #include "llcombobox.h" #include "lliconctrl.h" // Params #include "lltextbox.h" // Params +#include "lllocationhistory.h" class LLLandmark; @@ -137,7 +138,7 @@ private: void refreshHealth(); void positionMaturityIcon(); - void rebuildLocationHistory(std::string filter = ""); + void rebuildLocationHistory(const std::string& filter = LLStringUtil::null); bool findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter); void setText(const LLStringExplicit& text); void updateAddLandmarkButton(); @@ -147,7 +148,7 @@ private: void changeLocationPresentation(); void onInfoButtonClicked(); - void onLocationHistoryLoaded(); + void onLocationHistoryChanged(LLLocationHistory::EChangeType event); void onLocationPrearrange(const LLSD& data); void onTextEditorRightClicked(S32 x, S32 y, MASK mask); void onLandmarkLoaded(LLLandmark* lm); diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index d42e4bc250..e11df06d86 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -451,6 +451,12 @@ void LLNavigationBar::onLocationSelection() return; //get selected item from combobox item LLSD value = mCmbLocation->getSelectedValue(); + if(value.isUndefined() && !mCmbLocation->getTextEntry()->isDirty()) + { + // At this point we know that: there is no selected item in list and text field has NOT been changed + // So there is no sense to try to change the location + return; + } /* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item, * typed by user slurl or region name. Let's find out which type of item the user has selected * to make decision about adding this location into typed history. see mSaveToLocationHistory -- cgit v1.3 From 3556fd6bfa66ed483ad0de20fa1b38a9b562c4f1 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Mon, 1 Mar 2010 15:37:19 +0200 Subject: Fixed major bug (EXT-5671) Resizing viewer 2 redraws maturity icon in location bar when it shouldn't. --HG-- branch : product-engine --- indra/newview/lllocationinputctrl.cpp | 59 +++++++++++++++++++---------------- indra/newview/lllocationinputctrl.h | 1 + 2 files changed, 33 insertions(+), 27 deletions(-) (limited to 'indra/newview/lllocationinputctrl.cpp') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 0ea4b1f6da..4100e2fc61 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -577,7 +577,7 @@ void LLLocationInputCtrl::reshape(S32 width, S32 height, BOOL called_from_parent if (isHumanReadableLocationVisible) { - positionMaturityIcon(); + refreshMaturityIcon(); } } @@ -737,32 +737,7 @@ void LLLocationInputCtrl::refreshLocation() setText(location_name); isHumanReadableLocationVisible = true; - // Updating maturity rating icon. - LLViewerRegion* region = gAgent.getRegion(); - if (!region) - return; - - U8 sim_access = region->getSimAccess(); - switch(sim_access) - { - case SIM_ACCESS_PG: - mMaturityIcon->setValue(mIconMaturityGeneral->getName()); - mMaturityIcon->setVisible(TRUE); - break; - - case SIM_ACCESS_ADULT: - mMaturityIcon->setValue(mIconMaturityAdult->getName()); - mMaturityIcon->setVisible(TRUE); - break; - - default: - mMaturityIcon->setVisible(FALSE); - } - - if (mMaturityIcon->getVisible()) - { - positionMaturityIcon(); - } + refreshMaturityIcon(); } // returns new right edge @@ -878,6 +853,36 @@ void LLLocationInputCtrl::refreshHealth() } } +void LLLocationInputCtrl::refreshMaturityIcon() +{ + // Updating maturity rating icon. + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + return; + + U8 sim_access = region->getSimAccess(); + switch(sim_access) + { + case SIM_ACCESS_PG: + mMaturityIcon->setValue(mIconMaturityGeneral->getName()); + mMaturityIcon->setVisible(TRUE); + break; + + case SIM_ACCESS_ADULT: + mMaturityIcon->setValue(mIconMaturityAdult->getName()); + mMaturityIcon->setVisible(TRUE); + break; + + default: + mMaturityIcon->setVisible(FALSE); + } + + if (mMaturityIcon->getVisible()) + { + positionMaturityIcon(); + } +} + void LLLocationInputCtrl::positionMaturityIcon() { const LLFontGL* font = mTextEntry->getFont(); diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index dac6be2a24..f790140f07 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -136,6 +136,7 @@ private: void refreshParcelIcons(); // Refresh the value in the health percentage text field void refreshHealth(); + void refreshMaturityIcon(); void positionMaturityIcon(); void rebuildLocationHistory(const std::string& filter = LLStringUtil::null); -- cgit v1.3