From b47ff37612431ee820037768a18bdad9f47985fb Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 1 Feb 2019 11:54:55 -0500 Subject: [PATCH] Allow clicking on pictures in profiles and picks to open them Only works if it's not gonna spawn a texture picture, of course. --- indra/newview/llpanelavatar.cpp | 19 +++++++++++++++---- indra/newview/llpanelgroupgeneral.cpp | 5 ++++- indra/newview/llpanelpick.cpp | 5 ++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 285b47c4f..d1a431917 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -380,21 +380,32 @@ BOOL LLPanelAvatarSecondLife::postBuild() LLTextureCtrl* ctrl = getChild("img"); ctrl->setFallbackImageName("default_profile_picture.j2c"); + auto show_pic = [&] + { + show_picture(getChild("img")->getImageAssetID(), profile_picture_title(getChildView("dnname")->getValue())); + }; + auto show_pic_if_not_self = [=] { if (!ctrl->canChange()) show_pic(); }; - getChild("bigimg")->setCommitCallback(boost::bind(boost::bind(show_picture, boost::bind(&LLTextureCtrl::getImageAssetID, ctrl), boost::bind(profile_picture_title, boost::bind(&LLView::getValue, getChild("dnname")))))); + ctrl->setMouseUpCallback(std::bind(show_pic_if_not_self)); + getChild("bigimg")->setCommitCallback(std::bind(show_pic)); return TRUE; } BOOL LLPanelAvatarFirstLife::postBuild() { - BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); - enableControls(own_avatar); + enableControls(getPanelAvatar()->getAvatarID() == gAgentID); LLTextureCtrl* ctrl = getChild("img"); ctrl->setFallbackImageName("default_profile_picture.j2c"); + auto show_pic = [&] + { + show_picture(getChild("img")->getImageAssetID(), "First Life Picture"); + }; + auto show_pic_if_not_self = [=] { if (!ctrl->canChange()) show_pic(); }; - getChild("flbigimg")->setCommitCallback(boost::bind(boost::bind(boost::bind(show_picture, boost::bind(&LLTextureCtrl::getImageAssetID, ctrl), "First Life Picture")))); + ctrl->setMouseUpCallback(std::bind(show_pic_if_not_self)); + getChild("flbigimg")->setCommitCallback(std::bind(show_pic)); return TRUE; } diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 94047f771..c09f96dcf 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -130,7 +130,10 @@ BOOL LLPanelGroupGeneral::postBuild() mInsignia->setCommitCallback(boost::bind(&LLPanelGroupGeneral::onCommitAny,this)); mDefaultIconID = mInsignia->getImageAssetID(); void show_picture(const LLUUID& id, const std::string& name); - getChild("bigimg")->setCommitCallback(boost::bind(boost::bind(show_picture, boost::bind(&LLTextureCtrl::getImageAssetID, mInsignia), "Group Insignia"))); + auto show_pic = [this] { show_picture(mInsignia->getImageAssetID(), "Group Insignia"); }; + auto show_pic_if_not_self = [=] { if (!mInsignia->canChange()) show_pic(); }; + mInsignia->setMouseUpCallback(std::bind(show_pic_if_not_self)); + getChild("bigimg")->setCommitCallback(std::bind(show_pic)); } mEditCharter = getChild("charter", recurse); diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index 55e58a4c9..51fbd5f43 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -126,8 +126,11 @@ void LLPanelPick::reset() BOOL LLPanelPick::postBuild() { + auto show_pic = [this] { show_picture(mSnapshotCtrl->getImageAssetID(), mNameEditor->getText()); }; + auto show_pic_if_not_self = [=] { if (!mSnapshotCtrl->canChange()) show_pic(); }; mSnapshotCtrl = getChild("snapshot_ctrl"); mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelPick::onCommitAny, this)); + mSnapshotCtrl->setMouseUpCallback(std::bind(show_pic_if_not_self)); mNameEditor = getChild("given_name_editor"); mNameEditor->setCommitOnFocusLost(true); @@ -144,7 +147,7 @@ BOOL LLPanelPick::postBuild() mSetBtn->setCommitCallback(boost::bind(&LLPanelPick::onClickSet,this)); mOpenBtn = getChild("open_picture_btn"); - mOpenBtn->setCommitCallback(boost::bind(show_picture, boost::bind(&LLTextureCtrl::getImageAssetID, mSnapshotCtrl), boost::bind(&LLLineEditor::getText, mNameEditor))); + mOpenBtn->setCommitCallback(std::bind(show_pic)); getChild("pick_teleport_btn")->setCommitCallback(boost::bind(&LLPanelPick::onClickTeleport,this)); getChild("pick_map_btn")->setCommitCallback(boost::bind(&LLPanelPick::onClickMap,this));