Merge remote-tracking branch 'RyeMutt/viewer/minor-fixes' into DRTVWR-570-maint-Q

master
Andrey Lihatskiy 2022-11-01 23:12:58 +02:00
commit 31115dac2c
2 changed files with 10 additions and 12 deletions

View File

@ -1560,7 +1560,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
KEY_SHIFT != key &&
KEY_CONTROL != key &&
KEY_ALT != key &&
KEY_CAPSLOCK )
KEY_CAPSLOCK != key)
{
deselect();
}

View File

@ -2803,14 +2803,15 @@ void handle_object_show_original()
}
static void init_default_item_label(const std::string& item_name)
static void init_default_item_label(LLUICtrl* ctrl)
{
const std::string& item_name = ctrl->getName();
boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
if (it == sDefaultItemLabels.end())
{
// *NOTE: This will not work for items of type LLMenuItemCheckGL because they return boolean value
// (doesn't seem to matter much ATM).
LLStringExplicit default_label = gMenuHolder->childGetValue(item_name).asString();
LLStringExplicit default_label = ctrl->getValue().asString();
if (!default_label.empty())
{
sDefaultItemLabels.insert(std::pair<std::string, LLStringExplicit>(item_name, default_label));
@ -2841,18 +2842,17 @@ bool enable_object_touch(LLUICtrl* ctrl)
new_value = obj->flagHandleTouch() || (parent && parent->flagHandleTouch());
}
std::string item_name = ctrl->getName();
init_default_item_label(item_name);
init_default_item_label(ctrl);
// Update label based on the node touch name if available.
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
if (node && node->mValid && !node->mTouchName.empty())
{
gMenuHolder->childSetValue(item_name, node->mTouchName);
ctrl->setValue(node->mTouchName);
}
else
{
gMenuHolder->childSetValue(item_name, get_default_item_label(item_name));
ctrl->setValue(get_default_item_label(ctrl->getName()));
}
return new_value;
@ -6592,20 +6592,18 @@ bool enable_object_sit(LLUICtrl* ctrl)
bool sitting_on_sel = sitting_on_selection();
if (!sitting_on_sel)
{
std::string item_name = ctrl->getName();
// init default labels
init_default_item_label(item_name);
init_default_item_label(ctrl);
// Update label
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
if (node && node->mValid && !node->mSitName.empty())
{
gMenuHolder->childSetValue(item_name, node->mSitName);
ctrl->setValue(node->mSitName);
}
else
{
gMenuHolder->childSetValue(item_name, get_default_item_label(item_name));
ctrl->setValue(get_default_item_label(ctrl->getName()));
}
}
return !sitting_on_sel && is_object_sittable();