Skip to content

Restore option to change location of existing pick #3940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions indra/llui/llflatlistview.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
};

// disable traversal when finding widget to hand focus off to
/*virtual*/ bool canFocusChildren() const { return false; }
/*virtual*/ bool canFocusChildren() const override { return false; }

/**
* Connects callback to signal called when Return key is pressed.
*/
boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); }

/** Overridden LLPanel's reshape, height is ignored, the list sets its height to accommodate all items */
virtual void reshape(S32 width, S32 height, bool called_from_parent = true);
virtual void reshape(S32 width, S32 height, bool called_from_parent = true) override;

/** Returns full rect of child panel */
const LLRect& getItemsRect() const;

LLRect getRequiredRect() const { return getItemsRect(); }
LLRect getRequiredRect() override { return getItemsRect(); }

/** Returns distance between items */
const S32 getItemsPad() const { return mItemPad; }
Expand Down Expand Up @@ -270,7 +270,7 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
U32 size(const bool only_visible_items = true) const;

/** Removes all items from the list */
virtual void clear();
virtual void clear() override;

/**
* Removes all items that can be detached from the list but doesn't destroy
Expand All @@ -297,7 +297,7 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
void selectFirstItem();
void selectLastItem();

virtual S32 notify(const LLSD& info) ;
virtual S32 notify(const LLSD& info) override;

virtual ~LLFlatListView();

Expand Down Expand Up @@ -346,8 +346,8 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler

virtual bool selectNextItemPair(bool is_up_direction, bool reset_selection);

virtual bool canSelectAll() const;
virtual void selectAll();
virtual bool canSelectAll() const override;
virtual void selectAll() override;

virtual bool isSelected(item_pair_t* item_pair) const;

Expand All @@ -364,15 +364,15 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
*/
void notifyParentItemsRectChanged();

virtual bool handleKeyHere(KEY key, MASK mask);
virtual bool handleKeyHere(KEY key, MASK mask) override;

virtual bool postBuild();
virtual bool postBuild() override;

virtual void onFocusReceived();
virtual void onFocusReceived() override;

virtual void onFocusLost();
virtual void onFocusLost() override;

virtual void draw();
virtual void draw() override;

LLRect getLastSelectedItemRect();

Expand Down
2 changes: 1 addition & 1 deletion indra/llui/lltextbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LLTextBox :
bool mShowCursorHand;

protected:
virtual std::string _getSearchText() const
virtual std::string _getSearchText() const override
{
return LLTextBase::_getSearchText() + mText.getString();
}
Expand Down
42 changes: 42 additions & 0 deletions indra/newview/llpanelprofilepicks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ void LLPanelProfilePicks::onClickNewBtn()
select_tab(true).
label(pick_panel->getPickName()));
updateButtons();

pick_panel->addLocationChangedCallbacks();
}

void LLPanelProfilePicks::onClickDelete()
Expand Down Expand Up @@ -607,10 +609,12 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id)
{
mPickName->setEnabled(true);
mPickDescription->setEnabled(true);
mSetCurrentLocationButton->setVisible(true);
}
else
{
mSnapshotCtrl->setEnabled(false);
mSetCurrentLocationButton->setVisible(false);
}
}

Expand All @@ -621,6 +625,7 @@ bool LLPanelProfilePick::postBuild()
mSaveButton = getChild<LLButton>("save_changes_btn");
mCreateButton = getChild<LLButton>("create_changes_btn");
mCancelButton = getChild<LLButton>("cancel_changes_btn");
mSetCurrentLocationButton = getChild<LLButton>("set_to_curr_location_btn");

mSnapshotCtrl = getChild<LLTextureCtrl>("pick_snapshot");
mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelProfilePick::onSnapshotChanged, this));
Expand All @@ -633,6 +638,7 @@ bool LLPanelProfilePick::postBuild()
mSaveButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
mCreateButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
mCancelButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickCancel, this));
mSetCurrentLocationButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSetLocation, this));

mPickName->setKeystrokeCallback(boost::bind(&LLPanelProfilePick::onPickChanged, this, _1), NULL);
mPickName->setEnabled(false);
Expand Down Expand Up @@ -811,6 +817,32 @@ bool LLPanelProfilePick::isDirty() const
return false;
}

void LLPanelProfilePick::onClickSetLocation()
{
// Save location for later use.
setPosGlobal(gAgent.getPositionGlobal());

std::string parcel_name, region_name;

LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (parcel)
{
mParcelId = parcel->getID();
parcel_name = parcel->getName();
}

LLViewerRegion* region = gAgent.getRegion();
if (region)
{
region_name = region->getName();
}

setPickLocation(createLocationText(getLocationNotice(), parcel_name, region_name, getPosGlobal()));

mLocationChanged = true;
enableSaveButton(true);
}

void LLPanelProfilePick::onClickSave()
{
if (mRegionCallbackConnection.connected())
Expand All @@ -821,6 +853,10 @@ void LLPanelProfilePick::onClickSave()
{
mParcelCallbackConnection.disconnect();
}
if (mLocationChanged)
{
onClickSetLocation();
}
sendUpdate();

mLocationChanged = false;
Expand Down Expand Up @@ -871,6 +907,12 @@ void LLPanelProfilePick::processParcelInfo(const LLParcelData& parcel_data)
}
}

void LLPanelProfilePick::addLocationChangedCallbacks()
{
mRegionCallbackConnection = gAgent.addRegionChangedCallback([this]() { onClickSetLocation(); });
mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onClickSetLocation(); });
}

void LLPanelProfilePick::setParcelID(const LLUUID& parcel_id)
{
if (mParcelId != parcel_id)
Expand Down
10 changes: 9 additions & 1 deletion indra/newview/llpanelprofilepicks.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class LLPanelProfilePick
LLUUID getParcelID() const { return mParcelId; }
void setErrorStatus(S32 status, const std::string& reason) override {};

void addLocationChangedCallbacks();

protected:

/**
Expand Down Expand Up @@ -202,6 +204,11 @@ class LLPanelProfilePick
*/
void resetDirty() override;

/**
* Callback for "Set Location" button click
*/
void onClickSetLocation();

/**
* Callback for "Save" and "Create" button click
*/
Expand All @@ -224,6 +231,7 @@ class LLPanelProfilePick
LLTextureCtrl* mSnapshotCtrl;
LLLineEditor* mPickName;
LLTextEditor* mPickDescription;
LLButton* mSetCurrentLocationButton;
LLButton* mSaveButton;
LLButton* mCreateButton;
LLButton* mCancelButton;
Expand All @@ -241,7 +249,7 @@ class LLPanelProfilePick

bool mLocationChanged;
bool mNewPick;
bool mIsEditing;
bool mIsEditing;

void onDescriptionFocusReceived();
};
Expand Down
20 changes: 20 additions & 0 deletions indra/newview/skins/default/xui/en/panel_profile_pick.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,26 @@
/>
</layout_panel>

<layout_panel
follows="all"
layout="bottomleft"
left_pad="2"
name="set_to_curr_location_btn_lp"
auto_resize="false"
width="100">
<button
name="set_to_curr_location_btn"
label="Set Location"
tool_tip="Set to Current Location"
left="0"
top="0"
height="23"
width="100"
follows="left|top"
layout="topleft"
/>
</layout_panel>

<layout_panel
follows="all"
layout="topleft"
Expand Down
Loading