summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2010-05-20 16:51:35 +0300
committerMike Antipov <mantipov@productengine.com>2010-05-20 16:51:35 +0300
commitc75225bcb9781b090f1abcc93c4163230b8ad73e (patch)
treef9ea0a514fa34cc09e5989225850249488643805
parent5ba494c4fa3b085443c583bda7c193ce28fe15b3 (diff)
EXT-7104 WIP Enable Build button and set necessary callbacks.
Because it is not enough to call showInstance for Build Floater it was implemented in a such way: * set save_visibility==true in floater tools to update button toggle state properly and subscribe Build button to listen visibility changes * added callback to observe parcel changing to set build button enabled/disabled. KNOWN ISSUE: if build permissions are changed button will not change state until restart/teleport Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/413/ --HG-- branch : product-engine
-rw-r--r--indra/newview/llbottomtray.cpp35
-rw-r--r--indra/newview/skins/default/xui/en/floater_tools.xml1
-rw-r--r--indra/newview/skins/default/xui/en/panel_bottomtray.xml5
3 files changed, 31 insertions, 10 deletions
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 0595bedd31..caf43f5ddc 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -35,20 +35,32 @@
#define LLBOTTOMTRAY_CPP
#include "llbottomtray.h"
-#include "llagentcamera.h"
-#include "llchiclet.h"
+// library includes
#include "llfloaterreg.h"
#include "llflyoutbutton.h"
-#include "llimfloater.h" // for LLIMFloater
#include "lllayoutstack.h"
-#include "llnearbychatbar.h"
+#include "llnotifications.h"
#include "llnotificationsutil.h"
+#include "lltexteditor.h"
+
+// newview includes
+#include "llagentcamera.h"
+#include "llchiclet.h"
+#include "llfloatercamera.h"
+#include "llimfloater.h" // for LLIMFloater
+#include "llnearbychatbar.h"
#include "llspeakbutton.h"
#include "llsplitbutton.h"
#include "llsyswellwindow.h"
-#include "llfloatercamera.h"
-#include "lltexteditor.h"
-#include "llnotifications.h"
+#include "lltoolmgr.h"
+#include "llviewerparcelmgr.h"
+
+static void update_build_button_enable_state()
+{
+ bool can_edit = LLToolMgr::getInstance()->canEdit();
+
+ LLBottomTray::getInstance()->childSetEnabled("build_btn", can_edit);
+}
// Build time optimization, generate extern template once in .cpp file
template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance();
@@ -508,6 +520,8 @@ BOOL LLBottomTray::postBuild()
showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty());
showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty());
+ LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&update_build_button_enable_state));
+
return TRUE;
}
@@ -1246,6 +1260,13 @@ void LLBottomTray::setButtonsControlsAndListeners()
gSavedSettings.getControl("ShowSearchButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SEARCH, _2));
gSavedSettings.getControl("ShowWorldMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_WORLD_MAP, _2));
gSavedSettings.getControl("ShowMiniMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MINI_MAP, _2));
+
+
+ LLButton* build_btn = getChild<LLButton>("build_btn");
+ // set control name for Build button. It is not enough to link it with Button.SetFloaterToggle in xml
+ std::string vis_control_name = LLFloaterReg::declareVisibilityControl("build");
+ // Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
+ build_btn->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
}
bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, const LLSD& new_visibility)
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index 0c7ef3619d..c3c63cec37 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -11,6 +11,7 @@
save_rect="true"
short_title="BUILD TOOLS"
single_instance="true"
+ save_visibility="true"
sound_flags="0"
width="295">
<floater.string
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index 2ba7bef502..bfc40a8638 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -260,7 +260,6 @@ Disabled for now.
Disabled for now.
-->
<button
-enabled="false"
follows="left|right"
height="23"
image_pressed="PushButton_Press"
@@ -275,8 +274,8 @@ enabled="false"
top="5"
use_ellipses="true"
width="80">
- <init_callback
- function="Button.SetFloaterToggle"
+ <commit_callback
+ function="Build.Toggle"
parameter="build" />
</button>
</layout_panel>