summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-09-04 16:22:01 +0000
committerRider Linden <rider@lindenlab.com>2018-09-04 16:22:01 +0000
commitd1d248973d577d314bba16dc9f2977a7125b5f0d (patch)
tree6472b8a161224072ddde6ad5ffbc001fcc0dd028 /indra
parent5b11cad690ba03f1afe3763f4c1cfc125796796c (diff)
parenta4c49904c67e123df0d8e1f68714cf13acfa1ffc (diff)
Merged in andreykproductengine/maint-eep2 (pull request #68)
MAINT-8989 Menu updates button instead of executing command
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp2
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp2
-rw-r--r--indra/newview/llflyoutcombobtn.cpp36
-rw-r--r--indra/newview/llflyoutcombobtn.h8
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml2
-rw-r--r--indra/newview/skins/default/xui/en/menu_save_settings.xml54
6 files changed, 76 insertions, 28 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index a1689ed04c..94da304a96 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -173,7 +173,7 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
mImportButton = getChild<LLButton>(BTN_IMPORT, true);
mLoadFrame = getChild<LLButton>(BTN_LOADFRAME, true);
- mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE);
+ mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE, false);
mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); });
getChild<LLButton>(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onClickCloseBtn(); });
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 82f056710e..39e37034e7 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -108,7 +108,7 @@ BOOL LLFloaterFixedEnvironment::postBuild()
getChild<LLButton>(BUTTON_NAME_CANCEL)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onClickCloseBtn(); });
getChild<LLButton>(BUTTON_NAME_LOAD)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonLoad(); });
- mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE);
+ mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE, false);
mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); });
mFlyoutControl->setMenuItemVisible(ACTION_COMMIT, false);
diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp
index d1a8b46c92..b008ee13be 100644
--- a/indra/newview/llflyoutcombobtn.cpp
+++ b/indra/newview/llflyoutcombobtn.cpp
@@ -29,14 +29,21 @@
#include "llflyoutcombobtn.h"
#include "llviewermenu.h"
-LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file) :
- mParent(parent),
+LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent,
+ const std::string &action_button,
+ const std::string &flyout_button,
+ const std::string &menu_file,
+ bool apply_immediately) :
+ mParent(parent),
mActionButton(action_button),
- mFlyoutButton(flyout_button)
+ mFlyoutButton(flyout_button),
+ mApplyImmediately(apply_immediately)
{
- // register action mapping before creating menu
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
+ // register action mapping before creating menu
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
save_registar.add("FlyoutCombo.Button.Action", [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutItemSelected(ctrl, data); });
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enabled_rgistar;
+ enabled_rgistar.add("FlyoutCombo.Button.Check", [this](LLUICtrl *ctrl, const LLSD &data) { return onFlyoutItemCheck(ctrl, data); });
mParent->childSetAction(flyout_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutButton(ctrl, data); });
mParent->childSetAction(action_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutAction(ctrl, data); });
@@ -119,7 +126,24 @@ void LLFlyoutComboBtnCtrl::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data
LLMenuItemGL *pmenuitem = static_cast<LLMenuItemGL*>(ctrl);
setSelectedItem(pmenuitem);
- onFlyoutAction(pmenuitem, data);
+ if (mApplyImmediately)
+ {
+ onFlyoutAction(pmenuitem, data);
+ }
+}
+
+bool LLFlyoutComboBtnCtrl::onFlyoutItemCheck(LLUICtrl *ctrl, const LLSD &data)
+{
+ if (mApplyImmediately)
+ {
+ return false;
+ }
+ else
+ {
+ LLMenuItemGL *pmenuitem = static_cast<LLMenuItemGL*>(ctrl);
+
+ return pmenuitem->getName() == mSelectedName;
+ }
}
void LLFlyoutComboBtnCtrl::onFlyoutAction(LLUICtrl *ctrl, const LLSD &data)
diff --git a/indra/newview/llflyoutcombobtn.h b/indra/newview/llflyoutcombobtn.h
index 741ad03a37..b0dd4abadf 100644
--- a/indra/newview/llflyoutcombobtn.h
+++ b/indra/newview/llflyoutcombobtn.h
@@ -37,7 +37,11 @@ class LLFlyoutComboBtnCtrl
{
LOG_CLASS(LLFlyoutComboBtnCtrl);
public:
- LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file);
+ LLFlyoutComboBtnCtrl(LLPanel* parent,
+ const std::string &action_button,
+ const std::string &flyout_button,
+ const std::string &menu_file,
+ bool apply_immediately = true);
void setMenuItemEnabled(const std::string &item, bool enabled);
void setShownBtnEnabled(bool enabled);
@@ -52,6 +56,7 @@ public:
protected:
void onFlyoutButton(LLUICtrl *, const LLSD &);
void onFlyoutItemSelected(LLUICtrl *, const LLSD &);
+ bool onFlyoutItemCheck(LLUICtrl *, const LLSD &);
void onFlyoutAction(LLUICtrl *, const LLSD &);
void setSelectedItem(LLMenuItemGL *pitem);
@@ -63,6 +68,7 @@ private:
std::string mFlyoutButton;
std::string mSelectedName;
+ bool mApplyImmediately;
LLUICtrl::commit_signal_t mActionSignal;
};
diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
index e553948d9d..c8843db28b 100644
--- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
+++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
@@ -538,7 +538,7 @@ Select a key frame from the timeline above to edit settings.
left="5"
top_pad="0"
name="save_btn"
- width="150" />
+ width="156" />
<button
follows="top|left"
diff --git a/indra/newview/skins/default/xui/en/menu_save_settings.xml b/indra/newview/skins/default/xui/en/menu_save_settings.xml
index e3ed9a1741..84dacaa8b8 100644
--- a/indra/newview/skins/default/xui/en/menu_save_settings.xml
+++ b/indra/newview/skins/default/xui/en/menu_save_settings.xml
@@ -5,46 +5,64 @@
mouse_opaque="false"
name="save_settings_menu"
width="120">
- <menu_item_call
+ <menu_item_check
name="save_settings"
label="Save">
- <menu_item_call.on_click
+ <menu_item_check.on_check
+ function="FlyoutCombo.Button.Check"
+ userdata="save" />
+ <menu_item_check.on_click
function="FlyoutCombo.Button.Action"
userdata="save"/>
- </menu_item_call>
- <menu_item_call
+ </menu_item_check>
+ <menu_item_check
name="save_as_new_settings"
label="Save As">
- <menu_item_call.on_click
+ <menu_item_check.on_check
+ function="FlyoutCombo.Button.Check"
+ userdata="saveas" />
+ <menu_item_check.on_click
function="FlyoutCombo.Button.Action"
userdata="saveas" />
- </menu_item_call>
- <menu_item_call
+ </menu_item_check>
+ <menu_item_check
name="commit_changes"
label="Commit">
- <menu_item_call.on_click
+ <menu_item_check.on_check
+ function="FlyoutCombo.Button.Check"
+ userdata="commit" />
+ <menu_item_check.on_click
function="FlyoutCombo.Button.Action"
userdata="commit" />
- </menu_item_call>
- <menu_item_call
+ </menu_item_check>
+ <menu_item_check
name="apply_local"
label="Apply Only To Myself">
- <menu_item_call.on_click
+ <menu_item_check.on_check
+ function="FlyoutCombo.Button.Check"
+ userdata="local" />
+ <menu_item_check.on_click
function="FlyoutCombo.Button.Action"
userdata="local" />
- </menu_item_call>
- <menu_item_call
+ </menu_item_check>
+ <menu_item_check
name="apply_parcel"
label="Apply To Parcel">
- <menu_item_call.on_click
+ <menu_item_check.on_check
+ function="FlyoutCombo.Button.Check"
+ userdata="parcel" />
+ <menu_item_check.on_click
function="FlyoutCombo.Button.Action"
userdata="parcel" />
- </menu_item_call>
- <menu_item_call
+ </menu_item_check>
+ <menu_item_check
name="apply_region"
label="Apply To Region">
- <menu_item_call.on_click
+ <menu_item_check.on_check
+ function="FlyoutCombo.Button.Check"
+ userdata="region" />
+ <menu_item_check.on_click
function="FlyoutCombo.Button.Action"
userdata="region" />
- </menu_item_call>
+ </menu_item_check>
</toggleable_menu>