summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2021-07-09 16:43:10 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2021-07-09 16:43:10 +0300
commit8ca811f84989538d8834eb098103637d3d0d6673 (patch)
tree60ac18310844b81df791531cf37eb8c3a6c97461 /indra/newview
parent22524a009079e06c5b3de0d6fd57f5c9d2fd1cd7 (diff)
SL-14799 add "Hide beacon" button
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterworldmap.cpp102
-rw-r--r--indra/newview/llfloaterworldmap.h24
-rw-r--r--indra/newview/llviewerwindow.cpp3
-rw-r--r--indra/newview/skins/default/xui/en/panel_hide_beacon.xml20
-rw-r--r--indra/newview/skins/default/xui/en/panel_toolbar_view.xml2
5 files changed, 148 insertions, 3 deletions
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 27197f0b06..6ca134ecd3 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -56,6 +56,7 @@
#include "llscrolllistctrl.h"
#include "llslurl.h"
#include "lltextbox.h"
+#include "lltoolbarview.h"
#include "lltracker.h"
#include "lltrans.h"
#include "llviewerinventory.h" // LLViewerInventoryItem
@@ -87,6 +88,9 @@ static const F32 MAP_ZOOM_TIME = 0.2f;
// Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
static const S32 MAX_VISIBLE_REGIONS = 512;
+
+const S32 HIDE_BEACON_PAD = 133;
+
// It would be more logical to have this inside the method where it is used but to compile under gcc this
// struct has to be here.
struct SortRegionNames
@@ -1642,3 +1646,101 @@ void LLFloaterWorldMap::onFocusLost()
LLWorldMapView* map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
map_panel->mPanning = FALSE;
}
+
+LLPanelHideBeacon::LLPanelHideBeacon() :
+ mHideButton(NULL)
+{
+}
+
+// static
+LLPanelHideBeacon* LLPanelHideBeacon::getInstance()
+{
+ static LLPanelHideBeacon* panel = getPanelHideBeacon();
+ return panel;
+}
+
+
+BOOL LLPanelHideBeacon::postBuild()
+{
+ mHideButton = getChild<LLButton>("hide_beacon_btn");
+ mHideButton->setCommitCallback(boost::bind(&LLPanelHideBeacon::onHideButtonClick, this));
+
+ gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelHideBeacon::updatePosition, this));
+
+ return TRUE;
+}
+
+//virtual
+void LLPanelHideBeacon::draw()
+{
+ if (!LLTracker::isTracking(NULL))
+ {
+ return;
+ }
+ updatePosition();
+ LLPanel::draw();
+}
+
+//virtual
+void LLPanelHideBeacon::setVisible(BOOL visible)
+{
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
+
+ if (visible)
+ {
+ updatePosition();
+ }
+
+ LLPanel::setVisible(visible);
+}
+
+
+//static
+LLPanelHideBeacon* LLPanelHideBeacon::getPanelHideBeacon()
+{
+ LLPanelHideBeacon* panel = new LLPanelHideBeacon();
+ panel->buildFromFile("panel_hide_beacon.xml");
+
+ LL_INFOS() << "Build LLPanelHideBeacon panel" << LL_ENDL;
+
+ panel->updatePosition();
+ return panel;
+}
+
+void LLPanelHideBeacon::onHideButtonClick()
+{
+ LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
+ if (instance)
+ {
+ instance->onClearBtn();
+ }
+}
+
+/**
+* Updates position of the panel (similar to Stand & Stop Flying panel).
+*/
+void LLPanelHideBeacon::updatePosition()
+{
+ S32 bottom_tb_center = 0;
+ if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
+ {
+ bottom_tb_center = toolbar_bottom->getRect().getCenterX();
+ }
+
+ S32 left_tb_width = 0;
+ if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
+ {
+ left_tb_width = toolbar_left->getRect().getWidth();
+ }
+
+ if (gToolBarView != NULL && gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT)->hasButtons())
+ {
+ S32 x_pos = bottom_tb_center - getRect().getWidth() / 2 - left_tb_width;
+ setOrigin( x_pos + HIDE_BEACON_PAD, 0);
+ }
+ else
+ {
+ S32 x_pos = bottom_tb_center - getRect().getWidth() / 2;
+ setOrigin( x_pos + HIDE_BEACON_PAD, 0);
+ }
+}
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 97e99297cf..30cf1b9910 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -107,7 +107,8 @@ public:
// teleport to the tracked item, if there is one
void teleport();
void onChangeMaturity();
-
+
+ void onClearBtn();
//Slapp instigated avatar tracking
void avatarTrackFromSlapp( const LLUUID& id );
@@ -124,7 +125,6 @@ protected:
void onComboTextEntry( );
void onSearchTextEntry( );
- void onClearBtn();
void onClickTeleportBtn();
void onShowTargetBtn();
void onShowAgentBtn();
@@ -199,5 +199,25 @@ private:
extern LLFloaterWorldMap* gFloaterWorldMap;
+
+class LLPanelHideBeacon : public LLPanel
+{
+public:
+ static LLPanelHideBeacon* getInstance();
+
+ LLPanelHideBeacon();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void setVisible(BOOL visible);
+ /*virtual*/ void draw();
+
+private:
+ static LLPanelHideBeacon* getPanelHideBeacon();
+ void onHideButtonClick();
+ void updatePosition();
+
+ LLButton* mHideButton;
+
+};
+
#endif
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 21985d5a8a..dabe9379a6 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2279,6 +2279,9 @@ void LLViewerWindow::initWorldUI()
LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance();
panel_ssf_container->addChild(panel_stand_stop_flying);
+ LLPanelHideBeacon* panel_hide_beacon = LLPanelHideBeacon::getInstance();
+ panel_ssf_container->addChild(panel_hide_beacon);
+
panel_ssf_container->setVisible(TRUE);
LLMenuOptionPathfindingRebakeNavmesh::getInstance()->initialize();
diff --git a/indra/newview/skins/default/xui/en/panel_hide_beacon.xml b/indra/newview/skins/default/xui/en/panel_hide_beacon.xml
new file mode 100644
index 0000000000..cb22719cef
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_hide_beacon.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ height="25"
+ layout="topleft"
+ name="panel_hide_beacon"
+ mouse_opaque="false"
+ visible="true"
+ width="133">
+ <button
+ follows="left|bottom"
+ height="19"
+ label="Hide beacon"
+ layout="topleft"
+ left="10"
+ name="hide_beacon_btn"
+ tool_tip="Stop tracking and hide beacon"
+ top="2"
+ visible="true"
+ width="113" />
+</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
index f5c559fe1d..a3348f28c7 100644
--- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
+++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
@@ -95,7 +95,7 @@
tab_stop="false"
name="state_management_buttons_container"
visible="false"
- width="200"/>
+ width="350"/>
</layout_panel>
<layout_panel name="right_toolbar_panel"
auto_resize="false"