From dcb1bea0f6086d963fba8b374d0294223bf66a11 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 19 Sep 2019 16:55:28 +0300 Subject: SL-6109 Implement keybindings --- indra/newview/llfloaterpreference.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index b48495b5b2..9282196b86 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -170,7 +170,7 @@ public: void setParent(LLFloaterPreference* parent) { mParent = parent; } BOOL handleKeyHere(KEY key, MASK mask); - BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); + BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); static void onCancel(void* user_data); private: @@ -214,11 +214,11 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) return result; } -BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) +BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) { BOOL result = FALSE; if (down - && (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5) + && (clicktype == CLICK_MIDDLE || clicktype == CLICK_BUTTON4 || clicktype == CLICK_BUTTON5) && mask == 0) { mParent->setMouse(clicktype); @@ -1717,21 +1717,21 @@ void LLFloaterPreference::setKey(KEY key) getChild("modifier_combo")->onCommit(); } -void LLFloaterPreference::setMouse(LLMouseHandler::EClickType click) +void LLFloaterPreference::setMouse(EMouseClickType click) { std::string bt_name; std::string ctrl_value; switch (click) { - case LLMouseHandler::CLICK_MIDDLE: + case CLICK_MIDDLE: bt_name = "middle_mouse"; ctrl_value = MIDDLE_MOUSE_CV; break; - case LLMouseHandler::CLICK_BUTTON4: + case CLICK_BUTTON4: bt_name = "button4_mouse"; ctrl_value = MOUSE_BUTTON_4_CV; break; - case LLMouseHandler::CLICK_BUTTON5: + case CLICK_BUTTON5: bt_name = "button5_mouse"; ctrl_value = MOUSE_BUTTON_5_CV; break; -- cgit v1.2.3 From 50719510630768d65c9f00043676f287c58ca110 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 19 Aug 2019 23:16:29 +0300 Subject: SL_6109 Rebinding --- indra/newview/llfloaterpreference.cpp | 330 +++++++++++++++++++++++++++++++++- 1 file changed, 324 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 9282196b86..182341685b 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -52,6 +52,7 @@ #include "llfavoritesbar.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterimsession.h" +#include "llkeybindings.h" #include "llkeyboard.h" #include "llmodaldialog.h" #include "llnavigationbar.h" @@ -168,6 +169,7 @@ public: /*virtual*/ BOOL postBuild(); void setParent(LLFloaterPreference* parent) { mParent = parent; } + void setTmpParent(LLPanelPreferenceControls* parent) { mTmpParent = parent; } // todo: voice key will be removed, class renamved, so it will have only one parent BOOL handleKeyHere(KEY key, MASK mask); BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); @@ -175,11 +177,13 @@ public: private: LLFloaterPreference* mParent; + LLPanelPreferenceControls* mTmpParent;// todo: voice key will be removed, class renamved, so it will have only one parent }; LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key) : LLModalDialog(key), - mParent(NULL) + mParent(NULL), + mTmpParent(NULL) { } @@ -201,15 +205,30 @@ LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) { BOOL result = TRUE; + + if (key == KEY_CONTROL || key == KEY_SHIFT || key == KEY_ALT || key == KEY_NONE) + { + // temp + return false; + } + // todo, same for escape if (key == 'Q' && mask == MASK_CONTROL) { result = FALSE; - } + if (mTmpParent) + { + mTmpParent->onSetKey(KEY_NONE, MASK_NONE); + } + } else if (mParent) { mParent->setKey(key); } + else if (mTmpParent) + { + mTmpParent->onSetKey(key, mask); + } closeFloater(); return result; } @@ -217,11 +236,38 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) { BOOL result = FALSE; - if (down - && (clicktype == CLICK_MIDDLE || clicktype == CLICK_BUTTON4 || clicktype == CLICK_BUTTON5) - && mask == 0) + + if (clicktype == CLICK_LEFT) + { + if (down) + { + result = LLView::handleMouseDown(x, y, mask); + } + else + { + result = LLView::handleMouseUp(x, y, mask); + } + } + if (clicktype == LLMouseHandler::CLICK_LEFT) + { + result = LLView::handleDoubleClick(x, y, mask); + } + if (result) + { + return TRUE; + } + if (down && clicktype != LLMouseHandler::CLICK_RIGHT) //tmp + //&& (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5) + //&& mask == 0) { - mParent->setMouse(clicktype); + if (mParent) + { + mParent->setMouse(clicktype); + } + else if (mTmpParent) + { + mTmpParent->onSetMouse(clicktype, mask); + } result = TRUE; closeFloater(); } @@ -237,6 +283,11 @@ BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseCli void LLVoiceSetKeyDialog::onCancel(void* user_data) { LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; + // tmp needs 'no key' button + if (self->mTmpParent) + { + self->mTmpParent->onSetKey(KEY_NONE, MASK_NONE); + } self->closeFloater(); } @@ -2914,6 +2965,273 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() resetDirtyChilds(); } + +//-------------------For LLPanelPreferenceControls' list--------------------------- +class LLGroupControlsListItem : public LLScrollListItem, public LLHandleProvider +{ +public: + LLGroupControlsListItem(const LLScrollListItem::Params& p) + : LLScrollListItem(p) + { + } + + LLGroupControlsListItem(const LLScrollListItem::Params& p, const LLUUID& icon_id) + : LLScrollListItem(p), mIconId(icon_id) + { + } + + void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding) + { + // todo: insert image and adjust rect + LLScrollListItem::draw(rect, fg_color, bg_color, highlight_color, column_padding); + } +private: + LLUUID mIconId; +}; + +static const std::string tmp_typetostring[LLControlBindings::CONTROL_NUM_INDICES] = { + "control_view_actions", + "control_about", + "control_orbit", + "control_pan", + "control_world_map", + "control_zoom", + "control_interactions", + "control_build", + "control_drag", + "control_edit", + "control_menu", + "control_open", + "control_touch", + "control_wear", + "control_movements", + "control_moveto", + "control_sit", + "control_teleportto", + "control_forward", + "control_backward", + "control_left", + "control_right", + "control_lstrafe", + "control_rstrafe", + "control_jump", + "control_down", + "control_run", + "control_toggle_run", + "control_fly", + "control_mediacontent", + "control_parcel", + "control_media", + "control_voice", + "control_toggle_voice", + "control_reserved", + "control_menu", + "control_reserved_select", + "control_shift_select", + "control_cntrl_select" +}; + +//------------------------LLPanelPreferenceControls-------------------------------- +static LLPanelInjector t_pref_contrls("panel_preference_controls"); + +BOOL LLPanelPreferenceControls::postBuild() +{ + //todo: on open instead of on the go + //todo: add pitch/yaw? + //todo: Scroll? + //todo: should be auto-expandable with menu items and should pull names from menu when possible + + + // populate list of controls + pControlsTable = getChild("controls_list"); + populateControlTable(); + + pControlsTable->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onListCommit, this)); + + return TRUE; +} + +void LLPanelPreferenceControls::populateControlTable() +{ + pControlsTable->clearRows(); + + // todo: subsections need sorting? + std::string label; + LLScrollListCell::Params cell_params; + // init basic cell params + cell_params.font = LLFontGL::getFontSansSerif(); + cell_params.font_halign = LLFontGL::LEFT; + cell_params.column = ""; + cell_params.value = label; + + LLScrollListItem::Params item_params_blank; + cell_params.enabled = false; + item_params_blank.value = LLSD::Integer(-1); + item_params_blank.columns.add(cell_params); + cell_params.enabled = true; + + for (U32 i = LLControlBindings::CONTROL_VIEW_ACTIONS; i < LLControlBindings::CONTROL_NUM_INDICES; i++) + { + switch (i) + { + case LLControlBindings::CONTROL_VIEW_ACTIONS: + { + // same as below, but without separator + LLScrollListItem::Params item_params; + item_params.value = LLSD::Integer(i); + + label = getString(tmp_typetostring[i]); + cell_params.column = "lst_action"; + cell_params.value = label; + //dummy cells + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl1"; + cell_params.value = ""; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl2"; + cell_params.value = ""; + item_params.columns.add(cell_params); + LLUUID id; + LLGroupControlsListItem* item = new LLGroupControlsListItem(item_params, id); + pControlsTable->addRow(item, item_params, EAddPosition::ADD_BOTTOM); + break; + } + case LLControlBindings::CONTROL_INTERACTIONS: + case LLControlBindings::CONTROL_MOVEMENTS: + case LLControlBindings::CONTROL_MEDIACONTENT: + case LLControlBindings::CONTROL_RESERVED: + { + // insert blank + pControlsTable->addRow(item_params_blank, EAddPosition::ADD_BOTTOM); + // inster with icon + LLScrollListItem::Params item_params; + item_params.value = LLSD::Integer(i); + + label = getString(tmp_typetostring[i]); + cell_params.column = "lst_action"; + cell_params.value = label; + //dummy cells + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl1"; + cell_params.value = ""; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl2"; + cell_params.value = ""; + item_params.columns.add(cell_params); + LLUUID id; + LLGroupControlsListItem* item = new LLGroupControlsListItem(item_params, id); + pControlsTable->addRow(item, item_params, EAddPosition::ADD_BOTTOM); + break; + } + default: + { + //default insert + LLScrollListItem::Params item_params; + item_params.value = LLSD::Integer(i); + + // todo oddset + cell_params.column = "lst_action"; + label = getString(tmp_typetostring[i]); + cell_params.value = label; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl1"; + cell_params.value = gControlBindings.getPrimaryControl((LLControlBindings::EControlTypes)i).asString(); + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl2"; + cell_params.value = gControlBindings.getSecondaryControl((LLControlBindings::EControlTypes)i).asString(); + item_params.columns.add(cell_params); + + pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); + break; + } + } + } +} + +void LLPanelPreferenceControls::cancel() +{ +} + +void LLPanelPreferenceControls::saveSettings() +{ +} + +void LLPanelPreferenceControls::resetDirtyChilds() +{ +} + +bool LLPanelPreferenceControls::hasDirtyChilds() +{ + return false; +} + +void LLPanelPreferenceControls::onListCommit() +{ + LLScrollListItem* item = pControlsTable->getFirstSelected(); + if (item == NULL) + { + return; + } + + S32 control = item->getValue().asInteger(); + + if (!gControlBindings.canAssignControl((LLControlBindings::EControlTypes)control)) + { + return; + } + + // todo: add code to determine what cell was clicked, probably cells themself should be clickable + + LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); + if (dialog) + { + dialog->setTmpParent(this); // will be remade from being voice later + } +} + +void LLPanelPreferenceControls::onSetKey(KEY key, MASK mask) +{ + LLScrollListItem* item = pControlsTable->getFirstSelected(); + if (item == NULL) + { + return; + } + + LLControlBindings::EControlTypes control = (LLControlBindings::EControlTypes)item->getValue().asInteger(); + + if (!gControlBindings.canAssignControl(control)) + { + return; + } + + gControlBindings.registerPrimaryControl(control, LLMouseHandler::CLICK_NONE, key, mask); + + // instead of populating, update single element + populateControlTable(); +} + +void LLPanelPreferenceControls::onSetMouse(LLMouseHandler::EClickType click, MASK mask) +{ + + LLScrollListItem* item = pControlsTable->getFirstSelected(); + if (item == NULL) + { + return; + } + + LLControlBindings::EControlTypes control = (LLControlBindings::EControlTypes)item->getValue().asInteger(); + + if (!gControlBindings.canAssignControl(control)) + { + return; + } + + gControlBindings.registerPrimaryControl(control, click, KEY_NONE, mask); + + // instead of populating, update single element + populateControlTable(); +} + LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) : LLFloater(key) { -- cgit v1.2.3 From c21812bf095de2defa4e61978b2659764c838abf Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 17 Sep 2019 21:36:59 +0300 Subject: SL-6109 Keyaboard support ready --- indra/newview/llfloaterpreference.cpp | 680 ++++++++++++++++++---------------- 1 file changed, 366 insertions(+), 314 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 182341685b..4a4f66db14 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -52,7 +52,6 @@ #include "llfavoritesbar.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterimsession.h" -#include "llkeybindings.h" #include "llkeyboard.h" #include "llmodaldialog.h" #include "llnavigationbar.h" @@ -72,8 +71,9 @@ #include "lltrans.h" #include "llviewercontrol.h" #include "llviewercamera.h" -#include "llviewerwindow.h" +#include "llviewereventrecorder.h" #include "llviewermessage.h" +#include "llviewerwindow.h" #include "llviewershadermgr.h" #include "llviewerthrottle.h" #include "llvoavatarself.h" @@ -160,36 +160,49 @@ struct LabelTable : public LLInitParam::Block {} }; -class LLVoiceSetKeyDialog : public LLModalDialog +// Filters for LLSetKeyBindDialog +static const U32 ALLOW_MOUSE = 1; +static const U32 ALLOW_MASK_MOUSE = 2; +static const U32 ALLOW_KEYS = 4; //keyboard +static const U32 ALLOW_MASK_KEYS = 8; +static const U32 ALLOW_MASKS = 16; +static const U32 IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed +static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS; + +class LLSetKeyBindDialog : public LLModalDialog { public: - LLVoiceSetKeyDialog(const LLSD& key); - ~LLVoiceSetKeyDialog(); - + LLSetKeyBindDialog(const LLSD& key); + ~LLSetKeyBindDialog(); + /*virtual*/ BOOL postBuild(); - - void setParent(LLFloaterPreference* parent) { mParent = parent; } - void setTmpParent(LLPanelPreferenceControls* parent) { mTmpParent = parent; } // todo: voice key will be removed, class renamved, so it will have only one parent - + + void setParent(LLPanelPreferenceControls* parent, U32 key_mask = DEFAULT_KEY_FILTER); + BOOL handleKeyHere(KEY key, MASK mask); BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); static void onCancel(void* user_data); - + static void onBlank(void* user_data); + static void onDefault(void* user_data); + private: - LLFloaterPreference* mParent; - LLPanelPreferenceControls* mTmpParent;// todo: voice key will be removed, class renamved, so it will have only one parent + LLPanelPreferenceControls* mParent; + + U32 mKeyMask; }; -LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key) +LLSetKeyBindDialog::LLSetKeyBindDialog(const LLSD& key) : LLModalDialog(key), mParent(NULL), - mTmpParent(NULL) + mKeyMask(DEFAULT_KEY_FILTER) { } //virtual -BOOL LLVoiceSetKeyDialog::postBuild() +BOOL LLSetKeyBindDialog::postBuild() { + childSetAction("SetEmpty", onBlank, this); + childSetAction("Default", onDefault, this); childSetAction("Cancel", onCancel, this); getChild("Cancel")->setFocus(TRUE); @@ -198,47 +211,85 @@ BOOL LLVoiceSetKeyDialog::postBuild() return TRUE; } -LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() +void LLSetKeyBindDialog::setParent(LLPanelPreferenceControls* parent, U32 key_mask) +{ + mParent = parent; + mKeyMask = key_mask; + + LLTextBase *text_ctrl = getChild("descritption"); + + std::string input; + if ((key_mask & ALLOW_MOUSE) != 0) + { + input = getString("mouse"); + } + if ((key_mask & ALLOW_KEYS) != 0) + { + if (!input.empty()) + { + input += ", "; + } + input += getString("keyboard"); + } + text_ctrl->setTextArg("[INPUT]", input); +} + +LLSetKeyBindDialog::~LLSetKeyBindDialog() { } -BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) +BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) { BOOL result = TRUE; - if (key == KEY_CONTROL || key == KEY_SHIFT || key == KEY_ALT || key == KEY_NONE) + if ((key == 'Q' && mask == MASK_CONTROL) + || key == KEY_ESCAPE) + { + closeFloater(); + return true; + } + + // forbidden keys + if (key == KEY_NONE + || key == KEY_RETURN + || key == KEY_DELETE + || key == KEY_BACKSPACE) { - // temp return false; } - - // todo, same for escape - if (key == 'Q' && mask == MASK_CONTROL) - { - result = FALSE; - if (mTmpParent) - { - mTmpParent->onSetKey(KEY_NONE, MASK_NONE); - } + + if ((mKeyMask & ALLOW_MASKS) == 0 + && (key == KEY_CONTROL || key == KEY_SHIFT || key == KEY_ALT)) + { + // mask by themself are not allowed + return false; + } + else if ((mKeyMask & ALLOW_KEYS) == 0) + { + // basic keys not allowed + return false; + } + else if ((mKeyMask & ALLOW_MASK_KEYS) == 0 && mask != 0) + { + // masked keys not allowed + return false; } + else if (mParent) { - mParent->setKey(key); - } - else if (mTmpParent) - { - mTmpParent->onSetKey(key, mask); + mParent->onSetKeyBind(CLICK_NONE, key, mask); } closeFloater(); return result; } -BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) +BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) { BOOL result = FALSE; if (clicktype == CLICK_LEFT) { + // try handling buttons first if (down) { result = LLView::handleMouseDown(x, y, mask); @@ -248,30 +299,21 @@ BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseCli result = LLView::handleMouseUp(x, y, mask); } } - if (clicktype == LLMouseHandler::CLICK_LEFT) - { - result = LLView::handleDoubleClick(x, y, mask); - } - if (result) - { - return TRUE; - } - if (down && clicktype != LLMouseHandler::CLICK_RIGHT) //tmp - //&& (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5) - //&& mask == 0) + + if (!result + && ((mKeyMask & ALLOW_MOUSE) != 0) + && (clicktype != CLICK_RIGHT || mask != 0) // reassigning menu button is not supported + && ((mKeyMask & ALLOW_MASK_MOUSE) != 0 || mask == 0)) { if (mParent) { - mParent->setMouse(clicktype); - } - else if (mTmpParent) - { - mTmpParent->onSetMouse(clicktype, mask); + mParent->onSetKeyBind(clicktype, KEY_NONE, mask); } result = TRUE; closeFloater(); } - else + + if (!result) { result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); } @@ -280,17 +322,36 @@ BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseCli } //static -void LLVoiceSetKeyDialog::onCancel(void* user_data) +void LLSetKeyBindDialog::onCancel(void* user_data) { - LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; - // tmp needs 'no key' button - if (self->mTmpParent) - { - self->mTmpParent->onSetKey(KEY_NONE, MASK_NONE); - } + LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; self->closeFloater(); } +//static +void LLSetKeyBindDialog::onBlank(void* user_data) +{ + LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; + // tmp needs 'no key' button + if (self->mParent) + { + self->mParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE); + } + self->closeFloater(); +} + +//static +void LLSetKeyBindDialog::onDefault(void* user_data) +{ + LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; + // tmp needs 'no key' button + if (self->mParent) + { + self->mParent->onDefaultKeyBind(); + } + self->closeFloater(); +} + // global functions @@ -370,37 +431,6 @@ void handleAppearanceCameraMovementChanged(const LLSD& newvalue) } } -/*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 == option && floater ) - { - if ( floater ) - { - floater->setAllIgnored(); - // LLFirstUse::disableFirstUse(); - floater->buildPopupLists(); - } - } - return false; -} - -bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( 0 == option && floater ) - { - if ( floater ) - { - floater->resetAllIgnored(); - //LLFirstUse::resetFirstUse(); - floater->buildPopupLists(); - } - } - return false; -} -*/ - void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { numerator = 0; @@ -435,7 +465,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) static bool registered_dialog = false; if (!registered_dialog) { - LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("keybind_dialog", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); registered_dialog = true; } @@ -1754,53 +1784,6 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data) void LLFloaterPreference::onClickSetKey() { - LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); - if (dialog) - { - dialog->setParent(this); - } -} - -void LLFloaterPreference::setKey(KEY key) -{ - getChild("modifier_combo")->setValue(LLKeyboard::stringFromKey(key)); - // update the control right away since we no longer wait for apply - getChild("modifier_combo")->onCommit(); -} - -void LLFloaterPreference::setMouse(EMouseClickType click) -{ - std::string bt_name; - std::string ctrl_value; - switch (click) - { - case CLICK_MIDDLE: - bt_name = "middle_mouse"; - ctrl_value = MIDDLE_MOUSE_CV; - break; - case CLICK_BUTTON4: - bt_name = "button4_mouse"; - ctrl_value = MOUSE_BUTTON_4_CV; - break; - case CLICK_BUTTON5: - bt_name = "button5_mouse"; - ctrl_value = MOUSE_BUTTON_5_CV; - break; - default: - break; - } - - if (!ctrl_value.empty()) - { - LLUICtrl* p2t_line_editor = getChild("modifier_combo"); - // We are using text control names for readability and compatibility with voice - p2t_line_editor->setControlValue(ctrl_value); - LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); - if (advanced_preferences) - { - p2t_line_editor->setValue(advanced_preferences->getString(bt_name)); - } - } } void LLFloaterPreference::onClickSetMiddleMouse() @@ -1825,18 +1808,6 @@ void LLFloaterPreference::onClickSetSounds() getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); } -/* -void LLFloaterPreference::onClickSkipDialogs() -{ - LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); -} - -void LLFloaterPreference::onClickResetDialogs() -{ - LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); -} - */ - void LLFloaterPreference::onClickEnablePopup() { LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); @@ -2845,7 +2816,7 @@ void LLPanelPreferenceGraphics::setPresetText() } } - if (hasDirtyChilds() && !preset_graphic_active.empty()) + if (hasDirtyChilds() && !preset_graphic_active.empty()) { gSavedSettings.setString("PresetGraphicActive", ""); preset_graphic_active.clear(); @@ -2965,98 +2936,124 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() resetDirtyChilds(); } +//------------------------LLPanelPreferenceControls-------------------------------- +static LLPanelInjector t_pref_contrls("panel_preference_controls"); -//-------------------For LLPanelPreferenceControls' list--------------------------- -class LLGroupControlsListItem : public LLScrollListItem, public LLHandleProvider +LLPanelPreferenceControls::LLPanelPreferenceControls() + :LLPanelPreference(), + mEditingIndex(-1), + mEditingColumn(-1), + mEditingMode(0), + mShowKeyDialog(false) { -public: - LLGroupControlsListItem(const LLScrollListItem::Params& p) - : LLScrollListItem(p) - { - } - - LLGroupControlsListItem(const LLScrollListItem::Params& p, const LLUUID& icon_id) - : LLScrollListItem(p), mIconId(icon_id) - { - } - - void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding) - { - // todo: insert image and adjust rect - LLScrollListItem::draw(rect, fg_color, bg_color, highlight_color, column_padding); - } -private: - LLUUID mIconId; -}; - -static const std::string tmp_typetostring[LLControlBindings::CONTROL_NUM_INDICES] = { - "control_view_actions", - "control_about", - "control_orbit", - "control_pan", - "control_world_map", - "control_zoom", - "control_interactions", - "control_build", - "control_drag", - "control_edit", - "control_menu", - "control_open", - "control_touch", - "control_wear", - "control_movements", - "control_moveto", - "control_sit", - "control_teleportto", - "control_forward", - "control_backward", - "control_left", - "control_right", - "control_lstrafe", - "control_rstrafe", - "control_jump", - "control_down", - "control_run", - "control_toggle_run", - "control_fly", - "control_mediacontent", - "control_parcel", - "control_media", - "control_voice", - "control_toggle_voice", - "control_reserved", - "control_menu", - "control_reserved_select", - "control_shift_select", - "control_cntrl_select" -}; +} -//------------------------LLPanelPreferenceControls-------------------------------- -static LLPanelInjector t_pref_contrls("panel_preference_controls"); +LLPanelPreferenceControls::~LLPanelPreferenceControls() +{ +} BOOL LLPanelPreferenceControls::postBuild() { - //todo: on open instead of on the go //todo: add pitch/yaw? - //todo: Scroll? //todo: should be auto-expandable with menu items and should pull names from menu when possible // populate list of controls pControlsTable = getChild("controls_list"); - populateControlTable(); + pKeyModeBox = getChild("key_mode"); pControlsTable->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onListCommit, this)); + pKeyModeBox->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onModeCommit, this)); + getChild("restore_defaults")->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onRestoreDefaults, this)); return TRUE; } +// Something of a workaround: cells don't handle clicks, so we catch a click, then process it on hover. +BOOL LLPanelPreferenceControls::handleHover(S32 x, S32 y, MASK mask) +{ + if (mShowKeyDialog) + { + if (mEditingIndex > 0 && mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)mEditingIndex)) + { + mEditingColumn = pControlsTable->getColumnIndexFromOffset(x); + + if (mEditingColumn >0) + { + LLSetKeyBindDialog* dialog = LLFloaterReg::showTypedInstance("keybind_dialog", LLSD(), TRUE); + if (dialog) + { + if (mConflictHandler[mEditingMode].getLoadedMode() == LLKeyConflictHandler::MODE_GENERAL) + { + dialog->setParent(this, DEFAULT_KEY_FILTER); + } + else + { + dialog->setParent(this, ALLOW_KEYS | ALLOW_MASK_KEYS); + } + } + } + } + mShowKeyDialog = false; + } + return LLPanelPreference::handleHover(x, y, mask); +} + +void LLPanelPreferenceControls::addGroupRow(const std::string &icon, S32 index) +{ + LLScrollListItem::Params item_params; + item_params.value = LLSD::Integer(-1); + + LLScrollListCell::Params icon_cell_params; + icon_cell_params.font = LLFontGL::getFontSansSerif(); + icon_cell_params.font_halign = LLFontGL::LEFT; + icon_cell_params.type = "icontext"; + + LLScrollListCell::Params cell_params; + // init basic cell params + cell_params.font = LLFontGL::getFontSansSerif(); + cell_params.font_halign = LLFontGL::LEFT; + + std::string control_name = LLKeyConflictHandler::getControlName((LLKeyConflictHandler::EControlTypes)index); + std::string label; + if (hasString(control_name)) + { + label = getString(control_name); + } + else + { + label = control_name; + } + icon_cell_params.column = "lst_action"; + icon_cell_params.text = label; + icon_cell_params.value = icon; + item_params.columns.add(icon_cell_params); + //dummy cells + cell_params.column = "lst_ctrl1"; + cell_params.value = ""; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl2"; + cell_params.value = ""; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl3"; + cell_params.value = ""; + item_params.columns.add(cell_params); + pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); +} + +void LLPanelPreferenceControls::regenerateControls() +{ + mEditingMode = pKeyModeBox->getValue().asInteger(); + mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::EModes)mEditingMode); + populateControlTable(); +} + void LLPanelPreferenceControls::populateControlTable() { pControlsTable->clearRows(); // todo: subsections need sorting? - std::string label; + std::string label, control_name; LLScrollListCell::Params cell_params; // init basic cell params cell_params.font = LLFontGL::getFontSansSerif(); @@ -3064,81 +3061,71 @@ void LLPanelPreferenceControls::populateControlTable() cell_params.column = ""; cell_params.value = label; - LLScrollListItem::Params item_params_blank; - cell_params.enabled = false; - item_params_blank.value = LLSD::Integer(-1); - item_params_blank.columns.add(cell_params); - cell_params.enabled = true; - - for (U32 i = LLControlBindings::CONTROL_VIEW_ACTIONS; i < LLControlBindings::CONTROL_NUM_INDICES; i++) + S32 start = mEditingMode == LLKeyConflictHandler::MODE_GENERAL ? LLKeyConflictHandler::CONTROL_VIEW_ACTIONS : LLKeyConflictHandler::CONTROL_MOVEMENTS; + S32 end = mEditingMode == LLKeyConflictHandler::MODE_GENERAL ? LLKeyConflictHandler::CONTROL_NUM_INDICES : LLKeyConflictHandler::CONTROL_RESERVED; + for (S32 i = start; i < end; i++) { - switch (i) + LLKeyConflictHandler::EControlTypes type = (LLKeyConflictHandler::EControlTypes)i; + switch (type) { - case LLControlBindings::CONTROL_VIEW_ACTIONS: - { - // same as below, but without separator - LLScrollListItem::Params item_params; - item_params.value = LLSD::Integer(i); - - label = getString(tmp_typetostring[i]); - cell_params.column = "lst_action"; - cell_params.value = label; - //dummy cells - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl1"; - cell_params.value = ""; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl2"; - cell_params.value = ""; - item_params.columns.add(cell_params); - LLUUID id; - LLGroupControlsListItem* item = new LLGroupControlsListItem(item_params, id); - pControlsTable->addRow(item, item_params, EAddPosition::ADD_BOTTOM); - break; - } - case LLControlBindings::CONTROL_INTERACTIONS: - case LLControlBindings::CONTROL_MOVEMENTS: - case LLControlBindings::CONTROL_MEDIACONTENT: - case LLControlBindings::CONTROL_RESERVED: - { - // insert blank - pControlsTable->addRow(item_params_blank, EAddPosition::ADD_BOTTOM); - // inster with icon - LLScrollListItem::Params item_params; - item_params.value = LLSD::Integer(i); - - label = getString(tmp_typetostring[i]); - cell_params.column = "lst_action"; - cell_params.value = label; - //dummy cells - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl1"; - cell_params.value = ""; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl2"; - cell_params.value = ""; - item_params.columns.add(cell_params); - LLUUID id; - LLGroupControlsListItem* item = new LLGroupControlsListItem(item_params, id); - pControlsTable->addRow(item, item_params, EAddPosition::ADD_BOTTOM); - break; - } - default: + case LLKeyConflictHandler::CONTROL_VIEW_ACTIONS: + addSeparator(); + addGroupRow("Search_Icon", i); + break; + case LLKeyConflictHandler::CONTROL_INTERACTIONS: + addSeparator(); + addGroupRow("Command_Gestures_Icon", i); + break; + case LLKeyConflictHandler::CONTROL_MOVEMENTS: + addSeparator(); + addGroupRow("Move_Walk_Off", i); + break; + case LLKeyConflictHandler::CONTROL_MEDIACONTENT: + addSeparator(); + addGroupRow("Audio_Press", i); + break; + case LLKeyConflictHandler::CONTROL_CAMERA: + addSeparator(); + addGroupRow("Cam_FreeCam_Off", i); + break; + case LLKeyConflictHandler::CONTROL_EDIT_TITLE: + addSeparator(); + addGroupRow("Tool_Dozer", i); + break; + case LLKeyConflictHandler::CONTROL_RESERVED: + addSeparator(); + addGroupRow("Info_Small", i); + break; + default: { //default insert LLScrollListItem::Params item_params; item_params.value = LLSD::Integer(i); - // todo oddset cell_params.column = "lst_action"; - label = getString(tmp_typetostring[i]); + bool enabled = mConflictHandler[mEditingMode].canAssignControl(type); + control_name = LLKeyConflictHandler::getControlName(type); + if (hasString(control_name)) + { + label = getString(control_name); + } + else + { + label = control_name; + } cell_params.value = label; item_params.columns.add(cell_params); cell_params.column = "lst_ctrl1"; - cell_params.value = gControlBindings.getPrimaryControl((LLControlBindings::EControlTypes)i).asString(); + cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 0); + cell_params.enabled = enabled; item_params.columns.add(cell_params); cell_params.column = "lst_ctrl2"; - cell_params.value = gControlBindings.getSecondaryControl((LLControlBindings::EControlTypes)i).asString(); + cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 1); + cell_params.enabled = enabled; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl3"; + cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 2); + cell_params.enabled = enabled; item_params.columns.add(cell_params); pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); @@ -3146,23 +3133,64 @@ void LLPanelPreferenceControls::populateControlTable() } } } + + //temp + if (mEditingMode == LLKeyConflictHandler::MODE_GENERAL) + pControlsTable->setEnabled(false); } -void LLPanelPreferenceControls::cancel() +// Just a workaround to not care about first separator before headers (we can start from random header) +void LLPanelPreferenceControls::addSeparator() { + if (pControlsTable->getItemCount() > 0) + { + pControlsTable->addSeparator(EAddPosition::ADD_BOTTOM); + } } -void LLPanelPreferenceControls::saveSettings() +void LLPanelPreferenceControls::apply() { + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + { + if (mConflictHandler[i].hasUnsavedChanges()) + { + mConflictHandler[i].saveToSettings(); + } + } } -void LLPanelPreferenceControls::resetDirtyChilds() +void LLPanelPreferenceControls::cancel() { + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + { + if (mConflictHandler[i].hasUnsavedChanges()) + { + mConflictHandler[i].clear(); + } + } + pControlsTable->clear(); } -bool LLPanelPreferenceControls::hasDirtyChilds() +void LLPanelPreferenceControls::saveSettings() { - return false; + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + { + if (mConflictHandler[i].hasUnsavedChanges()) + { + mConflictHandler[i].saveToSettings(); + } + } + + S32 mode = pKeyModeBox->getValue().asInteger(); + if (mConflictHandler[mode].empty()) + { + regenerateControls(); + } +} + +void LLPanelPreferenceControls::resetDirtyChilds() +{ + regenerateControls(); } void LLPanelPreferenceControls::onListCommit() @@ -3175,61 +3203,85 @@ void LLPanelPreferenceControls::onListCommit() S32 control = item->getValue().asInteger(); - if (!gControlBindings.canAssignControl((LLControlBindings::EControlTypes)control)) + if (control <= 0) { return; } - - // todo: add code to determine what cell was clicked, probably cells themself should be clickable - LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); - if (dialog) + if (!mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)control)) { - dialog->setTmpParent(this); // will be remade from being voice later + return; } + + // List does not tell us what cell was clicked, so we have to figure it out manually, but + // fresh mouse coordinates are not yet accessible during onCommit() and there are other issues, + // so we cheat: remember item user clicked at, trigger 'key dialog' on hover that comes next, + // use coordinates from hover to calculate cell + mEditingIndex = control; + mShowKeyDialog = true; } -void LLPanelPreferenceControls::onSetKey(KEY key, MASK mask) +void LLPanelPreferenceControls::onModeCommit() { - LLScrollListItem* item = pControlsTable->getFirstSelected(); - if (item == NULL) + regenerateControls(); +} + +void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask) +{ + LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)mEditingIndex; + + if (!mConflictHandler[mEditingMode].canAssignControl(control)) { return; } - LLControlBindings::EControlTypes control = (LLControlBindings::EControlTypes)item->getValue().asInteger(); - - if (!gControlBindings.canAssignControl(control)) + pControlsTable->deselectAllItems(); + pControlsTable->selectByValue(mEditingIndex); + LLScrollListItem *item = pControlsTable->getFirstSelected(); + if (item && mEditingColumn > 0) { - return; + + mConflictHandler[mEditingMode].registerControl(control, mEditingColumn - 1, click, key, mask); + + LLScrollListCell *cell = item->getColumn(1); + cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 0)); + cell = item->getColumn(2); + cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 1)); + cell = item->getColumn(3); + cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2)); } - gControlBindings.registerPrimaryControl(control, LLMouseHandler::CLICK_NONE, key, mask); + populateControlTable(); +} - // instead of populating, update single element +void LLPanelPreferenceControls::onRestoreDefaults() +{ + mConflictHandler[mEditingMode].resetToDefaults(); populateControlTable(); } -void LLPanelPreferenceControls::onSetMouse(LLMouseHandler::EClickType click, MASK mask) +void LLPanelPreferenceControls::onDefaultKeyBind() { + LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)mEditingIndex; - LLScrollListItem* item = pControlsTable->getFirstSelected(); - if (item == NULL) + if (!mConflictHandler[mEditingMode].canAssignControl(control)) { return; } - LLControlBindings::EControlTypes control = (LLControlBindings::EControlTypes)item->getValue().asInteger(); - - if (!gControlBindings.canAssignControl(control)) + pControlsTable->deselectAllItems(); + pControlsTable->selectByValue(mEditingIndex); + LLScrollListItem *item = pControlsTable->getFirstSelected(); + if (item) { - return; - } + LLScrollListCell *cell = item->getColumn(mEditingColumn); - gControlBindings.registerPrimaryControl(control, click, KEY_NONE, mask); - - // instead of populating, update single element - populateControlTable(); + if (mEditingColumn > 0) + { + mConflictHandler[mEditingMode].resetToDefault(control, mEditingColumn - 1); + cell->setValue(mConflictHandler[mEditingMode].getControlString(control, mEditingColumn - 1)); + } + } } LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) -- cgit v1.2.3 From 08969001e25397cc947b5aa027522d3cc7aa8c53 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 25 Sep 2019 17:54:36 +0300 Subject: SL-6109 Mouse support ready --- indra/newview/llfloaterpreference.cpp | 92 +++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 27 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 4a4f66db14..9c706a0d3a 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -166,7 +166,7 @@ static const U32 ALLOW_MASK_MOUSE = 2; static const U32 ALLOW_KEYS = 4; //keyboard static const U32 ALLOW_MASK_KEYS = 8; static const U32 ALLOW_MASKS = 16; -static const U32 IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed +static const U32 CAN_IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS; class LLSetKeyBindDialog : public LLModalDialog @@ -176,6 +176,7 @@ public: ~LLSetKeyBindDialog(); /*virtual*/ BOOL postBuild(); + /*virtual*/ void onClose(bool app_quiting); void setParent(LLPanelPreferenceControls* parent, U32 key_mask = DEFAULT_KEY_FILTER); @@ -186,18 +187,23 @@ public: static void onDefault(void* user_data); private: - LLPanelPreferenceControls* mParent; + LLPanelPreferenceControls* pParent; + LLCheckBoxCtrl* pCheckBox; U32 mKeyMask; }; LLSetKeyBindDialog::LLSetKeyBindDialog(const LLSD& key) : LLModalDialog(key), - mParent(NULL), + pParent(NULL), mKeyMask(DEFAULT_KEY_FILTER) { } +LLSetKeyBindDialog::~LLSetKeyBindDialog() +{ +} + //virtual BOOL LLSetKeyBindDialog::postBuild() { @@ -205,15 +211,24 @@ BOOL LLSetKeyBindDialog::postBuild() childSetAction("Default", onDefault, this); childSetAction("Cancel", onCancel, this); getChild("Cancel")->setFocus(TRUE); - + + pCheckBox = getChild("ignore_masks"); + gFocusMgr.setKeystrokesOnly(TRUE); return TRUE; } +//virtual +void LLSetKeyBindDialog::onClose(bool app_quiting) +{ + pParent = NULL; + LLModalDialog::onClose(app_quiting); +} + void LLSetKeyBindDialog::setParent(LLPanelPreferenceControls* parent, U32 key_mask) { - mParent = parent; + pParent = parent; mKeyMask = key_mask; LLTextBase *text_ctrl = getChild("descritption"); @@ -232,10 +247,10 @@ void LLSetKeyBindDialog::setParent(LLPanelPreferenceControls* parent, U32 key_ma input += getString("keyboard"); } text_ctrl->setTextArg("[INPUT]", input); -} -LLSetKeyBindDialog::~LLSetKeyBindDialog() -{ + bool can_ignore_masks = (key_mask & CAN_IGNORE_MASKS) != 0; + pCheckBox->setVisible(can_ignore_masks); + pCheckBox->setValue(false); } BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) @@ -249,10 +264,19 @@ BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) return true; } + if (key == KEY_DELETE) + { + if (pParent) + { + pParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); + } + closeFloater(); + return true; + } + // forbidden keys if (key == KEY_NONE || key == KEY_RETURN - || key == KEY_DELETE || key == KEY_BACKSPACE) { return false; @@ -275,9 +299,9 @@ BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) return false; } - else if (mParent) + if (pParent) { - mParent->onSetKeyBind(CLICK_NONE, key, mask); + pParent->onSetKeyBind(CLICK_NONE, key, mask, pCheckBox->getValue().asBoolean()); } closeFloater(); return result; @@ -305,9 +329,9 @@ BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClic && (clicktype != CLICK_RIGHT || mask != 0) // reassigning menu button is not supported && ((mKeyMask & ALLOW_MASK_MOUSE) != 0 || mask == 0)) { - if (mParent) + if (pParent) { - mParent->onSetKeyBind(clicktype, KEY_NONE, mask); + pParent->onSetKeyBind(clicktype, KEY_NONE, mask, pCheckBox->getValue().asBoolean()); } result = TRUE; closeFloater(); @@ -333,9 +357,9 @@ void LLSetKeyBindDialog::onBlank(void* user_data) { LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; // tmp needs 'no key' button - if (self->mParent) + if (self->pParent) { - self->mParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE); + self->pParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); } self->closeFloater(); } @@ -345,9 +369,9 @@ void LLSetKeyBindDialog::onDefault(void* user_data) { LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; // tmp needs 'no key' button - if (self->mParent) + if (self->pParent) { - self->mParent->onDefaultKeyBind(); + self->pParent->onDefaultKeyBind(); } self->closeFloater(); } @@ -2972,6 +2996,23 @@ BOOL LLPanelPreferenceControls::postBuild() // Something of a workaround: cells don't handle clicks, so we catch a click, then process it on hover. BOOL LLPanelPreferenceControls::handleHover(S32 x, S32 y, MASK mask) { + /*S32 column = pControlsTable->getColumnIndexFromOffset(x); + LLScrollListItem* item = pControlsTable->hitItem(x, y); + static LLScrollListCell* last_cell = NULL; + if (item && column > 0) + { + LLScrollListCell* cell = item->getColumn(column); + if (cell) + { + cell->highlightText(0, CHAR_MAX); + if (last_cell != NULL && last_cell !=cell) + { + last_cell->highlightText(0, 0); + } + last_cell = cell; + } + }*/ + if (mShowKeyDialog) { if (mEditingIndex > 0 && mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)mEditingIndex)) @@ -2983,14 +3024,14 @@ BOOL LLPanelPreferenceControls::handleHover(S32 x, S32 y, MASK mask) LLSetKeyBindDialog* dialog = LLFloaterReg::showTypedInstance("keybind_dialog", LLSD(), TRUE); if (dialog) { - if (mConflictHandler[mEditingMode].getLoadedMode() == LLKeyConflictHandler::MODE_GENERAL) - { + /*if (mConflictHandler[mEditingMode].getLoadedMode() == LLKeyConflictHandler::MODE_GENERAL) + {*/ dialog->setParent(this, DEFAULT_KEY_FILTER); - } + /*} else { dialog->setParent(this, ALLOW_KEYS | ALLOW_MASK_KEYS); - } + }*/ } } } @@ -3133,10 +3174,6 @@ void LLPanelPreferenceControls::populateControlTable() } } } - - //temp - if (mEditingMode == LLKeyConflictHandler::MODE_GENERAL) - pControlsTable->setEnabled(false); } // Just a workaround to not care about first separator before headers (we can start from random header) @@ -3226,7 +3263,8 @@ void LLPanelPreferenceControls::onModeCommit() regenerateControls(); } -void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask) +// todo: copy onSetKeyBind to interface and inherit from interface +void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore_mask) { LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)mEditingIndex; @@ -3241,7 +3279,7 @@ void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS if (item && mEditingColumn > 0) { - mConflictHandler[mEditingMode].registerControl(control, mEditingColumn - 1, click, key, mask); + mConflictHandler[mEditingMode].registerControl(control, mEditingColumn - 1, click, key, mask, ignore_mask); LLScrollListCell *cell = item->getColumn(1); cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 0)); -- cgit v1.2.3 From 8f35d638fbdbbdcf80ad1e6d826fd6161a0a2387 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 25 Sep 2019 22:23:09 +0300 Subject: SL-6109 LMB DLMB in progress --- indra/newview/llfloaterpreference.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 9c706a0d3a..6085c92f49 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -167,7 +167,7 @@ static const U32 ALLOW_KEYS = 4; //keyboard static const U32 ALLOW_MASK_KEYS = 8; static const U32 ALLOW_MASKS = 16; static const U32 CAN_IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed -static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS; +static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS | CAN_IGNORE_MASKS; class LLSetKeyBindDialog : public LLModalDialog { @@ -2970,6 +2970,10 @@ LLPanelPreferenceControls::LLPanelPreferenceControls() mEditingMode(0), mShowKeyDialog(false) { + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + { + mConflictHandler[i].setLoadMode((LLKeyConflictHandler::EModes)i); + } } LLPanelPreferenceControls::~LLPanelPreferenceControls() @@ -3294,7 +3298,10 @@ void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS void LLPanelPreferenceControls::onRestoreDefaults() { - mConflictHandler[mEditingMode].resetToDefaults(); + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + { + mConflictHandler[mEditingMode].resetToDefaults(); + } populateControlTable(); } -- cgit v1.2.3 From 4080969968c5bac301d754e58ff938df6cbdb5a5 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 26 Sep 2019 22:28:18 +0300 Subject: SL-6109 Conflict resolution --- indra/newview/llfloaterpreference.cpp | 164 +++++++++++++++++++++------------- 1 file changed, 104 insertions(+), 60 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6085c92f49..c0e334795a 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -222,7 +222,11 @@ BOOL LLSetKeyBindDialog::postBuild() //virtual void LLSetKeyBindDialog::onClose(bool app_quiting) { - pParent = NULL; + if (pParent) + { + pParent->onCancelKeyBind(); + pParent = NULL; + } LLModalDialog::onClose(app_quiting); } @@ -269,6 +273,7 @@ BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) if (pParent) { pParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); + pParent = NULL; } closeFloater(); return true; @@ -302,6 +307,7 @@ BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) if (pParent) { pParent->onSetKeyBind(CLICK_NONE, key, mask, pCheckBox->getValue().asBoolean()); + pParent = NULL; } closeFloater(); return result; @@ -332,6 +338,7 @@ BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClic if (pParent) { pParent->onSetKeyBind(clicktype, KEY_NONE, mask, pCheckBox->getValue().asBoolean()); + pParent = NULL; } result = TRUE; closeFloater(); @@ -360,6 +367,7 @@ void LLSetKeyBindDialog::onBlank(void* user_data) if (self->pParent) { self->pParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); + self->pParent = NULL; } self->closeFloater(); } @@ -372,6 +380,7 @@ void LLSetKeyBindDialog::onDefault(void* user_data) if (self->pParent) { self->pParent->onDefaultKeyBind(); + self->pParent = NULL; } self->closeFloater(); } @@ -2968,11 +2977,12 @@ LLPanelPreferenceControls::LLPanelPreferenceControls() mEditingIndex(-1), mEditingColumn(-1), mEditingMode(0), - mShowKeyDialog(false) + mShowKeyDialog(false), + mHighlightedCell(NULL) { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { - mConflictHandler[i].setLoadMode((LLKeyConflictHandler::EModes)i); + mConflictHandler[i].setLoadMode((LLKeyConflictHandler::ESourceMode)i); } } @@ -3000,46 +3010,34 @@ BOOL LLPanelPreferenceControls::postBuild() // Something of a workaround: cells don't handle clicks, so we catch a click, then process it on hover. BOOL LLPanelPreferenceControls::handleHover(S32 x, S32 y, MASK mask) { - /*S32 column = pControlsTable->getColumnIndexFromOffset(x); - LLScrollListItem* item = pControlsTable->hitItem(x, y); - static LLScrollListCell* last_cell = NULL; - if (item && column > 0) - { - LLScrollListCell* cell = item->getColumn(column); - if (cell) - { - cell->highlightText(0, CHAR_MAX); - if (last_cell != NULL && last_cell !=cell) - { - last_cell->highlightText(0, 0); - } - last_cell = cell; - } - }*/ - if (mShowKeyDialog) { - if (mEditingIndex > 0 && mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)mEditingIndex)) + mShowKeyDialog = false; + if (mEditingIndex > 0 + && mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)mEditingIndex)) { - mEditingColumn = pControlsTable->getColumnIndexFromOffset(x); - - if (mEditingColumn >0) + LLScrollListItem* item = pControlsTable->getFirstSelected(); // don't use pControlsTable->hitItem(x, y) dur to drift; + if (item) { - LLSetKeyBindDialog* dialog = LLFloaterReg::showTypedInstance("keybind_dialog", LLSD(), TRUE); - if (dialog) + mEditingColumn = pControlsTable->getColumnIndexFromOffset(x); + if (mEditingColumn > 0) { - /*if (mConflictHandler[mEditingMode].getLoadedMode() == LLKeyConflictHandler::MODE_GENERAL) - {*/ - dialog->setParent(this, DEFAULT_KEY_FILTER); - /*} - else + LLScrollListCell* cell = item->getColumn(mEditingColumn); + if (cell) { - dialog->setParent(this, ALLOW_KEYS | ALLOW_MASK_KEYS); - }*/ + LLSetKeyBindDialog* dialog = LLFloaterReg::showTypedInstance("keybind_dialog", LLSD(), TRUE); + if (dialog) + { + dialog->setParent(this, DEFAULT_KEY_FILTER); + cell->setHighlighted(true); + mHighlightedCell = cell; + pControlsTable->deselectAllItems(); + return TRUE; + } + } } } } - mShowKeyDialog = false; } return LLPanelPreference::handleHover(x, y, mask); } @@ -3089,7 +3087,7 @@ void LLPanelPreferenceControls::addGroupRow(const std::string &icon, S32 index) void LLPanelPreferenceControls::regenerateControls() { mEditingMode = pKeyModeBox->getValue().asInteger(); - mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::EModes)mEditingMode); + mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::ESourceMode)mEditingMode); populateControlTable(); } @@ -3097,6 +3095,12 @@ void LLPanelPreferenceControls::populateControlTable() { pControlsTable->clearRows(); + if (mHighlightedCell) + { + mHighlightedCell->setHighlighted(false); + mHighlightedCell = NULL; + } + // todo: subsections need sorting? std::string label, control_name; LLScrollListCell::Params cell_params; @@ -3189,20 +3193,50 @@ void LLPanelPreferenceControls::addSeparator() } } +void LLPanelPreferenceControls::updateTable() +{ + std::vector list = pControlsTable->getAllData(); + for (S32 i = 0; i < list.size(); ++i) + { + S32 value = list[i]->getValue().asInteger(); + if (value > 0) + { + LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)value; + LLScrollListCell* cell = list[i]->getColumn(1); + cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 0)); + cell = list[i]->getColumn(2); + cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 1)); + cell = list[i]->getColumn(3); + cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2)); + } + } + + if (mHighlightedCell) + { + mHighlightedCell->setHighlighted(false); + mHighlightedCell = NULL; + } +} + void LLPanelPreferenceControls::apply() { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { if (mConflictHandler[i].hasUnsavedChanges()) { mConflictHandler[i].saveToSettings(); } } + if (mHighlightedCell) + { + mHighlightedCell->setHighlighted(false); + mHighlightedCell = NULL; + } } void LLPanelPreferenceControls::cancel() { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { if (mConflictHandler[i].hasUnsavedChanges()) { @@ -3210,11 +3244,16 @@ void LLPanelPreferenceControls::cancel() } } pControlsTable->clear(); + if (mHighlightedCell) + { + mHighlightedCell->setHighlighted(false); + mHighlightedCell = NULL; + } } void LLPanelPreferenceControls::saveSettings() { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { if (mConflictHandler[i].hasUnsavedChanges()) { @@ -3227,6 +3266,11 @@ void LLPanelPreferenceControls::saveSettings() { regenerateControls(); } + else if (mHighlightedCell) + { + mHighlightedCell->setHighlighted(false); + mHighlightedCell = NULL; + } } void LLPanelPreferenceControls::resetDirtyChilds() @@ -3260,6 +3304,12 @@ void LLPanelPreferenceControls::onListCommit() // use coordinates from hover to calculate cell mEditingIndex = control; mShowKeyDialog = true; + + if (mHighlightedCell) + { + mHighlightedCell->setHighlighted(false); + mHighlightedCell = NULL; + } } void LLPanelPreferenceControls::onModeCommit() @@ -3279,30 +3329,20 @@ void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS pControlsTable->deselectAllItems(); pControlsTable->selectByValue(mEditingIndex); - LLScrollListItem *item = pControlsTable->getFirstSelected(); - if (item && mEditingColumn > 0) + if ( mEditingColumn > 0) { - mConflictHandler[mEditingMode].registerControl(control, mEditingColumn - 1, click, key, mask, ignore_mask); - - LLScrollListCell *cell = item->getColumn(1); - cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 0)); - cell = item->getColumn(2); - cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 1)); - cell = item->getColumn(3); - cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2)); } - populateControlTable(); + updateTable(); } void LLPanelPreferenceControls::onRestoreDefaults() { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT; ++i) + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { mConflictHandler[mEditingMode].resetToDefaults(); } - populateControlTable(); } void LLPanelPreferenceControls::onDefaultKeyBind() @@ -3316,16 +3356,20 @@ void LLPanelPreferenceControls::onDefaultKeyBind() pControlsTable->deselectAllItems(); pControlsTable->selectByValue(mEditingIndex); - LLScrollListItem *item = pControlsTable->getFirstSelected(); - if (item) + + if (mEditingColumn > 0) { - LLScrollListCell *cell = item->getColumn(mEditingColumn); + mConflictHandler[mEditingMode].resetToDefault(control, mEditingColumn - 1); + } + updateTable(); +} - if (mEditingColumn > 0) - { - mConflictHandler[mEditingMode].resetToDefault(control, mEditingColumn - 1); - cell->setValue(mConflictHandler[mEditingMode].getControlString(control, mEditingColumn - 1)); - } +void LLPanelPreferenceControls::onCancelKeyBind() +{ + if (mHighlightedCell) + { + mHighlightedCell->setHighlighted(false); + mHighlightedCell = NULL; } } -- cgit v1.2.3 From a8e56e67c3545cf857f80e81b3e98a278224f421 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 27 Sep 2019 19:53:33 +0300 Subject: SL-6109 Cleanup, run commands, and preparation for tooltip support --- indra/newview/llfloaterpreference.cpp | 369 +++++++++++++++++++++------------- 1 file changed, 233 insertions(+), 136 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index c0e334795a..088a0820aa 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -185,18 +185,53 @@ public: static void onCancel(void* user_data); static void onBlank(void* user_data); static void onDefault(void* user_data); + static void onClickTimeout(void* user_data, MASK mask); + + class Updater; private: + void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); LLPanelPreferenceControls* pParent; LLCheckBoxCtrl* pCheckBox; - U32 mKeyMask; + U32 mKeyFilterMask; + Updater *pUpdater; +}; + +class LLSetKeyBindDialog::Updater : public LLEventTimer +{ +public: + + typedef boost::function callback_t; + + Updater(callback_t cb, F32 period, MASK mask) + :LLEventTimer(period), + mMask(mask), + mCallback(cb) + { + mEventTimer.start(); + } + + virtual ~Updater(){} + +protected: + BOOL tick() + { + mCallback(mMask); + // Deletes itseft after execution + return TRUE; + } + +private: + MASK mMask; + callback_t mCallback; }; LLSetKeyBindDialog::LLSetKeyBindDialog(const LLSD& key) : LLModalDialog(key), pParent(NULL), - mKeyMask(DEFAULT_KEY_FILTER) + mKeyFilterMask(DEFAULT_KEY_FILTER), + pUpdater(NULL) { } @@ -227,13 +262,19 @@ void LLSetKeyBindDialog::onClose(bool app_quiting) pParent->onCancelKeyBind(); pParent = NULL; } + if (pUpdater) + { + // Doubleclick timer has't fired, delete it + delete pUpdater; + pUpdater = NULL; + } LLModalDialog::onClose(app_quiting); } void LLSetKeyBindDialog::setParent(LLPanelPreferenceControls* parent, U32 key_mask) { pParent = parent; - mKeyMask = key_mask; + mKeyFilterMask = key_mask; LLTextBase *text_ctrl = getChild("descritption"); @@ -259,24 +300,18 @@ void LLSetKeyBindDialog::setParent(LLPanelPreferenceControls* parent, U32 key_ma BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) { - BOOL result = TRUE; - if ((key == 'Q' && mask == MASK_CONTROL) || key == KEY_ESCAPE) { closeFloater(); - return true; + return TRUE; } if (key == KEY_DELETE) { - if (pParent) - { - pParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); - pParent = NULL; - } + setKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); closeFloater(); - return true; + return FALSE; } // forbidden keys @@ -284,40 +319,41 @@ BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) || key == KEY_RETURN || key == KEY_BACKSPACE) { - return false; + return FALSE; } - if ((mKeyMask & ALLOW_MASKS) == 0 + if ((mKeyFilterMask & ALLOW_MASKS) == 0 && (key == KEY_CONTROL || key == KEY_SHIFT || key == KEY_ALT)) { // mask by themself are not allowed - return false; + return FALSE; } - else if ((mKeyMask & ALLOW_KEYS) == 0) + else if ((mKeyFilterMask & ALLOW_KEYS) == 0) { // basic keys not allowed - return false; + return FALSE; } - else if ((mKeyMask & ALLOW_MASK_KEYS) == 0 && mask != 0) + else if ((mKeyFilterMask & ALLOW_MASK_KEYS) == 0 && mask != 0) { // masked keys not allowed - return false; + return FALSE; } - if (pParent) - { - pParent->onSetKeyBind(CLICK_NONE, key, mask, pCheckBox->getValue().asBoolean()); - pParent = NULL; - } - closeFloater(); - return result; + setKeyBind(CLICK_NONE, key, mask, pCheckBox->getValue().asBoolean()); + closeFloater(); + return TRUE; } BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) { BOOL result = FALSE; - - if (clicktype == CLICK_LEFT) + if (!pParent) + { + // we already processed 'down' event, this is 'up', consume + closeFloater(); + result = TRUE; + } + if (!result && clicktype == CLICK_LEFT) { // try handling buttons first if (down) @@ -328,25 +364,38 @@ BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClic { result = LLView::handleMouseUp(x, y, mask); } + if (result) + { + setFocus(TRUE); + gFocusMgr.setKeystrokesOnly(TRUE); + } + // ignore selection related combinations + else if (down && (mask & (MASK_SHIFT | MASK_CONTROL)) == 0) + { + // this can be a double click, wait a bit; + if (!pUpdater) + { + // Note: default doubleclick time is 500ms, but can stretch up to 5s + pUpdater = new Updater(boost::bind(&onClickTimeout, this, _1), 0.7f, mask); + result = TRUE; + } + } } if (!result - && ((mKeyMask & ALLOW_MOUSE) != 0) + && (clicktype != CLICK_LEFT) // subcases were handled above + && ((mKeyFilterMask & ALLOW_MOUSE) != 0) && (clicktype != CLICK_RIGHT || mask != 0) // reassigning menu button is not supported - && ((mKeyMask & ALLOW_MASK_MOUSE) != 0 || mask == 0)) + && ((mKeyFilterMask & ALLOW_MASK_MOUSE) != 0 || mask == 0)) // reserved for selection { - if (pParent) + setKeyBind(clicktype, KEY_NONE, mask, pCheckBox->getValue().asBoolean()); + result = TRUE; + if (!down) { - pParent->onSetKeyBind(clicktype, KEY_NONE, mask, pCheckBox->getValue().asBoolean()); - pParent = NULL; + // wait for 'up' event before closing + // alternative: set pUpdater + closeFloater(); } - result = TRUE; - closeFloater(); - } - - if (!result) - { - result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); } return result; @@ -356,7 +405,7 @@ BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClic void LLSetKeyBindDialog::onCancel(void* user_data) { LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; - self->closeFloater(); + self->closeFloater(); } //static @@ -364,11 +413,7 @@ void LLSetKeyBindDialog::onBlank(void* user_data) { LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; // tmp needs 'no key' button - if (self->pParent) - { - self->pParent->onSetKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); - self->pParent = NULL; - } + self->setKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); self->closeFloater(); } @@ -376,7 +421,6 @@ void LLSetKeyBindDialog::onBlank(void* user_data) void LLSetKeyBindDialog::onDefault(void* user_data) { LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; - // tmp needs 'no key' button if (self->pParent) { self->pParent->onDefaultKeyBind(); @@ -385,6 +429,27 @@ void LLSetKeyBindDialog::onDefault(void* user_data) self->closeFloater(); } +//static +void LLSetKeyBindDialog::onClickTimeout(void* user_data, MASK mask) +{ + LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; + + // timer will delete itself after timeout + self->pUpdater = NULL; + + self->setKeyBind(CLICK_LEFT, KEY_NONE, mask, self->pCheckBox->getValue().asBoolean()); + self->closeFloater(); +} + +void LLSetKeyBindDialog::setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore) +{ + if (pParent) + { + pParent->onSetKeyBind(click, key, mask, ignore); + pParent = NULL; + } +} + // global functions @@ -2972,9 +3037,72 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() //------------------------LLPanelPreferenceControls-------------------------------- static LLPanelInjector t_pref_contrls("panel_preference_controls"); +//name of control and name of icon if it is a group, likely 'TEMP' until xml gets properly populated +typedef std::vector > controls_to_icon_t; +static const controls_to_icon_t commands_and_headers = +{ + //{ "control_view_actions", "Search_Icon" }, + //{ "control_interactions", "Command_Gestures_Icon" }, + { "control_movements", "Move_Walk_Off" }, + { "walk_to", "" }, + { "teleport_to", "" }, + { "push_forward", "" }, + { "push_backward", "" }, + { "turn_left", "" }, + { "turn_right", "" }, + { "slide_left", "" }, + { "slide_right", "" }, + { "jump", "" }, + { "push_down", "" }, + { "run_forward", "" }, + { "run_backward", "" }, + { "run_left", "" }, + { "run_right", "" }, + { "toggle_run", "" }, + { "toggle_fly", "" }, + { "toggle_sit", "" }, + { "stop_moving", "" }, + { "control_camera", "Cam_FreeCam_Off" }, + { "look_up", "" }, + { "look_down", "" }, + { "move_forward", "" }, + { "move_backward", "" }, + { "move_forward_fast", "" }, + { "move_backward_fast", "" }, + { "move_forward_sitting", "" }, + { "move_backward_sitting", "" }, + { "spin_over", "" }, + { "spin_under", "" }, + { "spin_over_sitting", "" }, + { "spin_under_sitting", "" }, + { "pan_up", "" }, + { "pan_down", "" }, + { "pan_left", "" }, + { "pan_right", "" }, + { "pan_in", "" }, + { "pan_out", "" }, + { "spin_around_ccw", "" }, + { "spin_around_cw", "" }, + { "spin_around_ccw_sitting", "" }, + { "spin_around_cw_sitting", "" }, + { "control_edit_title", "Tool_Dozer" }, + { "edit_avatar_spin_ccw", "" }, + { "edit_avatar_spin_cw", "" }, + { "edit_avatar_spin_over", "" }, + { "edit_avatar_spin_under", "" }, + { "edit_avatar_move_forward", "" }, + { "edit_avatar_move_backward", "" }, + { "control_mediacontent", "Audio_Press" }, + { "toggle_pause_media", "" }, + { "toggle_enable_media", "" }, + { "voice_follow_key", "" }, + { "toggle_voice", "" }, + { "start_chat", "" }, + { "start_gesture", "" }, +}; + LLPanelPreferenceControls::LLPanelPreferenceControls() :LLPanelPreference(), - mEditingIndex(-1), mEditingColumn(-1), mEditingMode(0), mShowKeyDialog(false), @@ -3013,8 +3141,8 @@ BOOL LLPanelPreferenceControls::handleHover(S32 x, S32 y, MASK mask) if (mShowKeyDialog) { mShowKeyDialog = false; - if (mEditingIndex > 0 - && mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)mEditingIndex)) + if (!mEditingControl.empty() + && mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) { LLScrollListItem* item = pControlsTable->getFirstSelected(); // don't use pControlsTable->hitItem(x, y) dur to drift; if (item) @@ -3042,10 +3170,10 @@ BOOL LLPanelPreferenceControls::handleHover(S32 x, S32 y, MASK mask) return LLPanelPreference::handleHover(x, y, mask); } -void LLPanelPreferenceControls::addGroupRow(const std::string &icon, S32 index) +void LLPanelPreferenceControls::addGroupRow(const std::string &control_name, const std::string &icon) { LLScrollListItem::Params item_params; - item_params.value = LLSD::Integer(-1); + item_params.value = ""; LLScrollListCell::Params icon_cell_params; icon_cell_params.font = LLFontGL::getFontSansSerif(); @@ -3057,7 +3185,6 @@ void LLPanelPreferenceControls::addGroupRow(const std::string &icon, S32 index) cell_params.font = LLFontGL::getFontSansSerif(); cell_params.font_halign = LLFontGL::LEFT; - std::string control_name = LLKeyConflictHandler::getControlName((LLKeyConflictHandler::EControlTypes)index); std::string label; if (hasString(control_name)) { @@ -3110,76 +3237,48 @@ void LLPanelPreferenceControls::populateControlTable() cell_params.column = ""; cell_params.value = label; - S32 start = mEditingMode == LLKeyConflictHandler::MODE_GENERAL ? LLKeyConflictHandler::CONTROL_VIEW_ACTIONS : LLKeyConflictHandler::CONTROL_MOVEMENTS; - S32 end = mEditingMode == LLKeyConflictHandler::MODE_GENERAL ? LLKeyConflictHandler::CONTROL_NUM_INDICES : LLKeyConflictHandler::CONTROL_RESERVED; - for (S32 i = start; i < end; i++) + controls_to_icon_t::const_iterator iter = commands_and_headers.begin(); + controls_to_icon_t::const_iterator end = commands_and_headers.end(); + for (; iter != end; ++iter) { - LLKeyConflictHandler::EControlTypes type = (LLKeyConflictHandler::EControlTypes)i; - switch (type) + if (iter->second.empty()) { - case LLKeyConflictHandler::CONTROL_VIEW_ACTIONS: - addSeparator(); - addGroupRow("Search_Icon", i); - break; - case LLKeyConflictHandler::CONTROL_INTERACTIONS: - addSeparator(); - addGroupRow("Command_Gestures_Icon", i); - break; - case LLKeyConflictHandler::CONTROL_MOVEMENTS: - addSeparator(); - addGroupRow("Move_Walk_Off", i); - break; - case LLKeyConflictHandler::CONTROL_MEDIACONTENT: - addSeparator(); - addGroupRow("Audio_Press", i); - break; - case LLKeyConflictHandler::CONTROL_CAMERA: - addSeparator(); - addGroupRow("Cam_FreeCam_Off", i); - break; - case LLKeyConflictHandler::CONTROL_EDIT_TITLE: - addSeparator(); - addGroupRow("Tool_Dozer", i); - break; - case LLKeyConflictHandler::CONTROL_RESERVED: - addSeparator(); - addGroupRow("Info_Small", i); - break; - default: + // general control + LLScrollListItem::Params item_params; + item_params.value = LLSD(iter->first); + + cell_params.column = "lst_action"; + bool enabled = mConflictHandler[mEditingMode].canAssignControl(iter->first); + if (hasString(iter->first)) { - //default insert - LLScrollListItem::Params item_params; - item_params.value = LLSD::Integer(i); - - cell_params.column = "lst_action"; - bool enabled = mConflictHandler[mEditingMode].canAssignControl(type); - control_name = LLKeyConflictHandler::getControlName(type); - if (hasString(control_name)) - { - label = getString(control_name); - } - else - { - label = control_name; - } - cell_params.value = label; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl1"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 0); - cell_params.enabled = enabled; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl2"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 1); - cell_params.enabled = enabled; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl3"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 2); - cell_params.enabled = enabled; - item_params.columns.add(cell_params); - - pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); - break; + label = getString(iter->first); } + else + { + label = iter->first; + } + cell_params.value = label; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl1"; + cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 0); + cell_params.enabled = enabled; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl2"; + cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 1); + cell_params.enabled = enabled; + item_params.columns.add(cell_params); + cell_params.column = "lst_ctrl3"; + cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 2); + cell_params.enabled = enabled; + item_params.columns.add(cell_params); + + pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); + } + else + { + // header + addSeparator(); + addGroupRow(iter->first, iter->second); } } } @@ -3195,13 +3294,13 @@ void LLPanelPreferenceControls::addSeparator() void LLPanelPreferenceControls::updateTable() { + mEditingControl.clear(); std::vector list = pControlsTable->getAllData(); for (S32 i = 0; i < list.size(); ++i) { - S32 value = list[i]->getValue().asInteger(); - if (value > 0) + std::string control = list[i]->getValue(); + if (!control.empty()) { - LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)value; LLScrollListCell* cell = list[i]->getColumn(1); cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 0)); cell = list[i]->getColumn(2); @@ -3258,6 +3357,7 @@ void LLPanelPreferenceControls::saveSettings() if (mConflictHandler[i].hasUnsavedChanges()) { mConflictHandler[i].saveToSettings(); + mConflictHandler[i].clear(); } } @@ -3280,20 +3380,21 @@ void LLPanelPreferenceControls::resetDirtyChilds() void LLPanelPreferenceControls::onListCommit() { + mShowKeyDialog = false; LLScrollListItem* item = pControlsTable->getFirstSelected(); if (item == NULL) { return; } - S32 control = item->getValue().asInteger(); + std::string control = item->getValue(); - if (control <= 0) + if (control.empty()) { return; } - if (!mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)control)) + if (!mConflictHandler[mEditingMode].canAssignControl(control)) { return; } @@ -3302,7 +3403,7 @@ void LLPanelPreferenceControls::onListCommit() // fresh mouse coordinates are not yet accessible during onCommit() and there are other issues, // so we cheat: remember item user clicked at, trigger 'key dialog' on hover that comes next, // use coordinates from hover to calculate cell - mEditingIndex = control; + mEditingControl = control; mShowKeyDialog = true; if (mHighlightedCell) @@ -3320,18 +3421,16 @@ void LLPanelPreferenceControls::onModeCommit() // todo: copy onSetKeyBind to interface and inherit from interface void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore_mask) { - LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)mEditingIndex; - - if (!mConflictHandler[mEditingMode].canAssignControl(control)) + if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) { return; } pControlsTable->deselectAllItems(); - pControlsTable->selectByValue(mEditingIndex); + pControlsTable->selectByValue(mEditingControl); if ( mEditingColumn > 0) { - mConflictHandler[mEditingMode].registerControl(control, mEditingColumn - 1, click, key, mask, ignore_mask); + mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, ignore_mask); } updateTable(); @@ -3347,19 +3446,17 @@ void LLPanelPreferenceControls::onRestoreDefaults() void LLPanelPreferenceControls::onDefaultKeyBind() { - LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)mEditingIndex; - - if (!mConflictHandler[mEditingMode].canAssignControl(control)) + if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) { return; } pControlsTable->deselectAllItems(); - pControlsTable->selectByValue(mEditingIndex); + pControlsTable->selectByValue(mEditingControl); if (mEditingColumn > 0) { - mConflictHandler[mEditingMode].resetToDefault(control, mEditingColumn - 1); + mConflictHandler[mEditingMode].resetToDefault(mEditingControl, mEditingColumn - 1); } updateTable(); } -- cgit v1.2.3 From fc03a5679e34a35f3e4773198b52cac1bd6be0b7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 1 Oct 2019 22:23:49 +0300 Subject: SL-6109 Better hover and docking of keybinder --- indra/newview/llfloaterpreference.cpp | 131 ++++++++++++---------------------- 1 file changed, 46 insertions(+), 85 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 088a0820aa..16f2426d1b 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -43,6 +43,7 @@ #include "llcombobox.h" #include "llcommandhandler.h" #include "lldirpicker.h" +#include "lldrawfrustum.h" #include "lleventtimer.h" #include "llfeaturemanager.h" #include "llfocusmgr.h" @@ -169,14 +170,15 @@ static const U32 ALLOW_MASKS = 16; static const U32 CAN_IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS | CAN_IGNORE_MASKS; -class LLSetKeyBindDialog : public LLModalDialog +class LLSetKeyBindDialog : public LLModalDialog, public LLDrawFrustum { public: LLSetKeyBindDialog(const LLSD& key); ~LLSetKeyBindDialog(); /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose(bool app_quiting); + /*virtual*/ void onClose(bool app_quiting); + /*virtual*/ void draw(); void setParent(LLPanelPreferenceControls* parent, U32 key_mask = DEFAULT_KEY_FILTER); @@ -271,9 +273,18 @@ void LLSetKeyBindDialog::onClose(bool app_quiting) LLModalDialog::onClose(app_quiting); } +//virtual +void LLSetKeyBindDialog::draw() +{ + LLRect local_rect; + drawFrustum(local_rect, this, (LLView*)getDragHandle(), hasFocus()); + LLModalDialog::draw(); +} + void LLSetKeyBindDialog::setParent(LLPanelPreferenceControls* parent, U32 key_mask) { pParent = parent; + setFrustumOrigin(parent); mKeyFilterMask = key_mask; LLTextBase *text_ctrl = getChild("descritption"); @@ -3104,9 +3115,7 @@ static const controls_to_icon_t commands_and_headers = LLPanelPreferenceControls::LLPanelPreferenceControls() :LLPanelPreference(), mEditingColumn(-1), - mEditingMode(0), - mShowKeyDialog(false), - mHighlightedCell(NULL) + mEditingMode(0) { for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { @@ -3135,41 +3144,6 @@ BOOL LLPanelPreferenceControls::postBuild() return TRUE; } -// Something of a workaround: cells don't handle clicks, so we catch a click, then process it on hover. -BOOL LLPanelPreferenceControls::handleHover(S32 x, S32 y, MASK mask) -{ - if (mShowKeyDialog) - { - mShowKeyDialog = false; - if (!mEditingControl.empty() - && mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) - { - LLScrollListItem* item = pControlsTable->getFirstSelected(); // don't use pControlsTable->hitItem(x, y) dur to drift; - if (item) - { - mEditingColumn = pControlsTable->getColumnIndexFromOffset(x); - if (mEditingColumn > 0) - { - LLScrollListCell* cell = item->getColumn(mEditingColumn); - if (cell) - { - LLSetKeyBindDialog* dialog = LLFloaterReg::showTypedInstance("keybind_dialog", LLSD(), TRUE); - if (dialog) - { - dialog->setParent(this, DEFAULT_KEY_FILTER); - cell->setHighlighted(true); - mHighlightedCell = cell; - pControlsTable->deselectAllItems(); - return TRUE; - } - } - } - } - } - } - return LLPanelPreference::handleHover(x, y, mask); -} - void LLPanelPreferenceControls::addGroupRow(const std::string &control_name, const std::string &icon) { LLScrollListItem::Params item_params; @@ -3221,13 +3195,7 @@ void LLPanelPreferenceControls::regenerateControls() void LLPanelPreferenceControls::populateControlTable() { pControlsTable->clearRows(); - - if (mHighlightedCell) - { - mHighlightedCell->setHighlighted(false); - mHighlightedCell = NULL; - } - + // todo: subsections need sorting? std::string label, control_name; LLScrollListCell::Params cell_params; @@ -3294,6 +3262,7 @@ void LLPanelPreferenceControls::addSeparator() void LLPanelPreferenceControls::updateTable() { + pControlsTable->deselectAllItems(); mEditingControl.clear(); std::vector list = pControlsTable->getAllData(); for (S32 i = 0; i < list.size(); ++i) @@ -3309,12 +3278,6 @@ void LLPanelPreferenceControls::updateTable() cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2)); } } - - if (mHighlightedCell) - { - mHighlightedCell->setHighlighted(false); - mHighlightedCell = NULL; - } } void LLPanelPreferenceControls::apply() @@ -3326,11 +3289,6 @@ void LLPanelPreferenceControls::apply() mConflictHandler[i].saveToSettings(); } } - if (mHighlightedCell) - { - mHighlightedCell->setHighlighted(false); - mHighlightedCell = NULL; - } } void LLPanelPreferenceControls::cancel() @@ -3343,11 +3301,6 @@ void LLPanelPreferenceControls::cancel() } } pControlsTable->clear(); - if (mHighlightedCell) - { - mHighlightedCell->setHighlighted(false); - mHighlightedCell = NULL; - } } void LLPanelPreferenceControls::saveSettings() @@ -3366,11 +3319,6 @@ void LLPanelPreferenceControls::saveSettings() { regenerateControls(); } - else if (mHighlightedCell) - { - mHighlightedCell->setHighlighted(false); - mHighlightedCell = NULL; - } } void LLPanelPreferenceControls::resetDirtyChilds() @@ -3380,7 +3328,6 @@ void LLPanelPreferenceControls::resetDirtyChilds() void LLPanelPreferenceControls::onListCommit() { - mShowKeyDialog = false; LLScrollListItem* item = pControlsTable->getFirstSelected(); if (item == NULL) { @@ -3391,11 +3338,20 @@ void LLPanelPreferenceControls::onListCommit() if (control.empty()) { + pControlsTable->deselectAllItems(); return; } if (!mConflictHandler[mEditingMode].canAssignControl(control)) { + pControlsTable->deselectAllItems(); + return; + } + + S32 cell_ind = item->getSelectedCell(); + if (cell_ind <= 0) + { + pControlsTable->deselectAllItems(); return; } @@ -3403,13 +3359,27 @@ void LLPanelPreferenceControls::onListCommit() // fresh mouse coordinates are not yet accessible during onCommit() and there are other issues, // so we cheat: remember item user clicked at, trigger 'key dialog' on hover that comes next, // use coordinates from hover to calculate cell - mEditingControl = control; - mShowKeyDialog = true; - if (mHighlightedCell) + LLScrollListCell* cell = item->getColumn(cell_ind); + if (cell) + { + LLSetKeyBindDialog* dialog = LLFloaterReg::getTypedInstance("keybind_dialog", LLSD()); + if (dialog) + { + mEditingControl = control; + mEditingColumn = cell_ind; + dialog->setParent(this, DEFAULT_KEY_FILTER); + + LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) + root_floater->addDependentFloater(dialog); + dialog->openFloater(); + dialog->setFocus(TRUE); + } + } + else { - mHighlightedCell->setHighlighted(false); - mHighlightedCell = NULL; + pControlsTable->deselectAllItems(); } } @@ -3426,8 +3396,6 @@ void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS return; } - pControlsTable->deselectAllItems(); - pControlsTable->selectByValue(mEditingControl); if ( mEditingColumn > 0) { mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, ignore_mask); @@ -3450,10 +3418,7 @@ void LLPanelPreferenceControls::onDefaultKeyBind() { return; } - - pControlsTable->deselectAllItems(); - pControlsTable->selectByValue(mEditingControl); - + if (mEditingColumn > 0) { mConflictHandler[mEditingMode].resetToDefault(mEditingControl, mEditingColumn - 1); @@ -3463,11 +3428,7 @@ void LLPanelPreferenceControls::onDefaultKeyBind() void LLPanelPreferenceControls::onCancelKeyBind() { - if (mHighlightedCell) - { - mHighlightedCell->setHighlighted(false); - mHighlightedCell = NULL; - } + pControlsTable->deselectAllItems(); } LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) -- cgit v1.2.3 From b6890180eae59529a5825a47f80c9833c0959352 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 2 Oct 2019 20:51:47 +0300 Subject: SL-6109 Removed obsolete control, moved table init to xml, cleanup --- indra/newview/llfloaterpreference.cpp | 245 ++++++++-------------------------- 1 file changed, 52 insertions(+), 193 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 16f2426d1b..2354be25e9 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -564,8 +564,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mGotPersonalInfo(false), mOriginalIMViaEmail(false), mLanguageChanged(false), - mAvatarDataInitialized(false), - mClickActionDirty(false) + mAvatarDataInitialized(false) { LLConversationLog::instance().addObserver(this); @@ -587,7 +586,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); - mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); @@ -615,8 +613,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) sSkin = gSavedSettings.getString("SkinCurrent"); - mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); - gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); @@ -883,12 +879,6 @@ void LLFloaterPreference::apply() } saveAvatarProperties(); - - if (mClickActionDirty) - { - updateClickActionSettings(); - mClickActionDirty = false; - } } void LLFloaterPreference::cancel() @@ -921,12 +911,6 @@ void LLFloaterPreference::cancel() // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); - if (mClickActionDirty) - { - updateClickActionControls(); - mClickActionDirty = false; - } - LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); if (advanced_proxy_settings) { @@ -1008,9 +992,6 @@ void LLFloaterPreference::onOpen(const LLSD& key) onChangeTextureFolder(); onChangeSoundFolder(); onChangeAnimationFolder(); - - // Load (double-)click to walk/teleport settings. - updateClickActionControls(); // Enabled/disabled popups, might have been changed by user actions // while preferences floater was closed. @@ -1891,10 +1872,6 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data) refresh(); } -void LLFloaterPreference::onClickSetKey() -{ -} - void LLFloaterPreference::onClickSetMiddleMouse() { LLUICtrl* p2t_line_editor = getChild("modifier_combo"); @@ -2378,11 +2355,6 @@ void LLFloaterPreference::onClickAdvanced() } } -void LLFloaterPreference::onClickActionChange() -{ - mClickActionDirty = true; -} - void LLFloaterPreference::onClickPermsDefault() { LLFloaterReg::showInstance("perms_default"); @@ -2420,26 +2392,6 @@ void LLFloaterPreference::onLogChatHistorySaved() } } -void LLFloaterPreference::updateClickActionSettings() -{ - const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); - const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); - - gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); - gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); -} - -void LLFloaterPreference::updateClickActionControls() -{ - const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); - const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); - const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); - - getChild("single_click_action_combo")->setValue((int)click_to_walk); - getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); -} - void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); @@ -3048,70 +3000,6 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() //------------------------LLPanelPreferenceControls-------------------------------- static LLPanelInjector t_pref_contrls("panel_preference_controls"); -//name of control and name of icon if it is a group, likely 'TEMP' until xml gets properly populated -typedef std::vector > controls_to_icon_t; -static const controls_to_icon_t commands_and_headers = -{ - //{ "control_view_actions", "Search_Icon" }, - //{ "control_interactions", "Command_Gestures_Icon" }, - { "control_movements", "Move_Walk_Off" }, - { "walk_to", "" }, - { "teleport_to", "" }, - { "push_forward", "" }, - { "push_backward", "" }, - { "turn_left", "" }, - { "turn_right", "" }, - { "slide_left", "" }, - { "slide_right", "" }, - { "jump", "" }, - { "push_down", "" }, - { "run_forward", "" }, - { "run_backward", "" }, - { "run_left", "" }, - { "run_right", "" }, - { "toggle_run", "" }, - { "toggle_fly", "" }, - { "toggle_sit", "" }, - { "stop_moving", "" }, - { "control_camera", "Cam_FreeCam_Off" }, - { "look_up", "" }, - { "look_down", "" }, - { "move_forward", "" }, - { "move_backward", "" }, - { "move_forward_fast", "" }, - { "move_backward_fast", "" }, - { "move_forward_sitting", "" }, - { "move_backward_sitting", "" }, - { "spin_over", "" }, - { "spin_under", "" }, - { "spin_over_sitting", "" }, - { "spin_under_sitting", "" }, - { "pan_up", "" }, - { "pan_down", "" }, - { "pan_left", "" }, - { "pan_right", "" }, - { "pan_in", "" }, - { "pan_out", "" }, - { "spin_around_ccw", "" }, - { "spin_around_cw", "" }, - { "spin_around_ccw_sitting", "" }, - { "spin_around_cw_sitting", "" }, - { "control_edit_title", "Tool_Dozer" }, - { "edit_avatar_spin_ccw", "" }, - { "edit_avatar_spin_cw", "" }, - { "edit_avatar_spin_over", "" }, - { "edit_avatar_spin_under", "" }, - { "edit_avatar_move_forward", "" }, - { "edit_avatar_move_backward", "" }, - { "control_mediacontent", "Audio_Press" }, - { "toggle_pause_media", "" }, - { "toggle_enable_media", "" }, - { "voice_follow_key", "" }, - { "toggle_voice", "" }, - { "start_chat", "" }, - { "start_gesture", "" }, -}; - LLPanelPreferenceControls::LLPanelPreferenceControls() :LLPanelPreference(), mEditingColumn(-1), @@ -3129,10 +3017,6 @@ LLPanelPreferenceControls::~LLPanelPreferenceControls() BOOL LLPanelPreferenceControls::postBuild() { - //todo: add pitch/yaw? - //todo: should be auto-expandable with menu items and should pull names from menu when possible - - // populate list of controls pControlsTable = getChild("controls_list"); pKeyModeBox = getChild("key_mode"); @@ -3144,47 +3028,6 @@ BOOL LLPanelPreferenceControls::postBuild() return TRUE; } -void LLPanelPreferenceControls::addGroupRow(const std::string &control_name, const std::string &icon) -{ - LLScrollListItem::Params item_params; - item_params.value = ""; - - LLScrollListCell::Params icon_cell_params; - icon_cell_params.font = LLFontGL::getFontSansSerif(); - icon_cell_params.font_halign = LLFontGL::LEFT; - icon_cell_params.type = "icontext"; - - LLScrollListCell::Params cell_params; - // init basic cell params - cell_params.font = LLFontGL::getFontSansSerif(); - cell_params.font_halign = LLFontGL::LEFT; - - std::string label; - if (hasString(control_name)) - { - label = getString(control_name); - } - else - { - label = control_name; - } - icon_cell_params.column = "lst_action"; - icon_cell_params.text = label; - icon_cell_params.value = icon; - item_params.columns.add(icon_cell_params); - //dummy cells - cell_params.column = "lst_ctrl1"; - cell_params.value = ""; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl2"; - cell_params.value = ""; - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl3"; - cell_params.value = ""; - item_params.columns.add(cell_params); - pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); -} - void LLPanelPreferenceControls::regenerateControls() { mEditingMode = pKeyModeBox->getValue().asInteger(); @@ -3195,58 +3038,74 @@ void LLPanelPreferenceControls::regenerateControls() void LLPanelPreferenceControls::populateControlTable() { pControlsTable->clearRows(); - - // todo: subsections need sorting? - std::string label, control_name; + pControlsTable->clearColumns(); + + std::string filename; + switch ((LLKeyConflictHandler::ESourceMode)mEditingMode) + { + case LLKeyConflictHandler::MODE_THIRD_PERSON: + case LLKeyConflictHandler::MODE_FIRST_PERSON: + case LLKeyConflictHandler::MODE_EDIT: + case LLKeyConflictHandler::MODE_EDIT_AVATAR: + case LLKeyConflictHandler::MODE_SITTING: + filename = "control_table_contents.xml"; + break; + default: + // 'saved settings' mode doesn't have UI or actual settings yet + LL_INFOS() << "Unimplemented mode" << LL_ENDL; + return; + } + + std::string full_filename = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, filename); + LLSimpleXUIParser parser; + LLScrollListCtrl::Contents contents; + if (!parser.readXUI(full_filename, contents) + || !contents.validateBlock()) + { + LL_INFOS() << "Failed to load" << LL_ENDL; + return; + } + + for (LLInitParam::ParamIterator::const_iterator row_it = contents.columns.begin(); + row_it != contents.columns.end(); + ++row_it) + { + pControlsTable->addColumn(*row_it); + } + LLScrollListCell::Params cell_params; // init basic cell params cell_params.font = LLFontGL::getFontSansSerif(); cell_params.font_halign = LLFontGL::LEFT; cell_params.column = ""; - cell_params.value = label; + cell_params.value = ""; - controls_to_icon_t::const_iterator iter = commands_and_headers.begin(); - controls_to_icon_t::const_iterator end = commands_and_headers.end(); - for (; iter != end; ++iter) + + for (LLInitParam::ParamIterator::const_iterator row_it = contents.rows.begin(); + row_it != contents.rows.end(); + ++row_it) { - if (iter->second.empty()) + std::string control = row_it->value.getValue().asString(); + if (!control.empty() && control != "menu_separator") { - // general control - LLScrollListItem::Params item_params; - item_params.value = LLSD(iter->first); - - cell_params.column = "lst_action"; - bool enabled = mConflictHandler[mEditingMode].canAssignControl(iter->first); - if (hasString(iter->first)) - { - label = getString(iter->first); - } - else - { - label = iter->first; - } - cell_params.value = label; - item_params.columns.add(cell_params); + // At the moment 4 collumns are hardcoded + LLScrollListItem::Params item_params(*row_it); + bool enabled = mConflictHandler[mEditingMode].canAssignControl(control); + item_params.enabled.setValue(enabled); cell_params.column = "lst_ctrl1"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 0); - cell_params.enabled = enabled; + cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 0); item_params.columns.add(cell_params); cell_params.column = "lst_ctrl2"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 1); - cell_params.enabled = enabled; + cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 1); item_params.columns.add(cell_params); cell_params.column = "lst_ctrl3"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(iter->first, 2); - cell_params.enabled = enabled; + cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 2); item_params.columns.add(cell_params); - pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); } else { - // header - addSeparator(); - addGroupRow(iter->first, iter->second); + pControlsTable->addRow(*row_it, EAddPosition::ADD_BOTTOM); } } } @@ -3262,7 +3121,6 @@ void LLPanelPreferenceControls::addSeparator() void LLPanelPreferenceControls::updateTable() { - pControlsTable->deselectAllItems(); mEditingControl.clear(); std::vector list = pControlsTable->getAllData(); for (S32 i = 0; i < list.size(); ++i) @@ -3278,6 +3136,7 @@ void LLPanelPreferenceControls::updateTable() cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2)); } } + pControlsTable->deselectAllItems(); } void LLPanelPreferenceControls::apply() -- cgit v1.2.3 From b8c5ae8d8fcf9219112c4ab48233615732737e44 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 3 Oct 2019 19:46:12 +0300 Subject: SL-6109 Better menu accelerator support and slight reorganization --- indra/newview/llfloaterpreference.cpp | 306 +--------------------------------- 1 file changed, 3 insertions(+), 303 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 2354be25e9..6ee1bbee1a 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -43,7 +43,6 @@ #include "llcombobox.h" #include "llcommandhandler.h" #include "lldirpicker.h" -#include "lldrawfrustum.h" #include "lleventtimer.h" #include "llfeaturemanager.h" #include "llfocusmgr.h" @@ -161,306 +160,6 @@ struct LabelTable : public LLInitParam::Block {} }; -// Filters for LLSetKeyBindDialog -static const U32 ALLOW_MOUSE = 1; -static const U32 ALLOW_MASK_MOUSE = 2; -static const U32 ALLOW_KEYS = 4; //keyboard -static const U32 ALLOW_MASK_KEYS = 8; -static const U32 ALLOW_MASKS = 16; -static const U32 CAN_IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed -static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS | CAN_IGNORE_MASKS; - -class LLSetKeyBindDialog : public LLModalDialog, public LLDrawFrustum -{ -public: - LLSetKeyBindDialog(const LLSD& key); - ~LLSetKeyBindDialog(); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose(bool app_quiting); - /*virtual*/ void draw(); - - void setParent(LLPanelPreferenceControls* parent, U32 key_mask = DEFAULT_KEY_FILTER); - - BOOL handleKeyHere(KEY key, MASK mask); - BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); - static void onCancel(void* user_data); - static void onBlank(void* user_data); - static void onDefault(void* user_data); - static void onClickTimeout(void* user_data, MASK mask); - - class Updater; - -private: - void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); - LLPanelPreferenceControls* pParent; - LLCheckBoxCtrl* pCheckBox; - - U32 mKeyFilterMask; - Updater *pUpdater; -}; - -class LLSetKeyBindDialog::Updater : public LLEventTimer -{ -public: - - typedef boost::function callback_t; - - Updater(callback_t cb, F32 period, MASK mask) - :LLEventTimer(period), - mMask(mask), - mCallback(cb) - { - mEventTimer.start(); - } - - virtual ~Updater(){} - -protected: - BOOL tick() - { - mCallback(mMask); - // Deletes itseft after execution - return TRUE; - } - -private: - MASK mMask; - callback_t mCallback; -}; - -LLSetKeyBindDialog::LLSetKeyBindDialog(const LLSD& key) - : LLModalDialog(key), - pParent(NULL), - mKeyFilterMask(DEFAULT_KEY_FILTER), - pUpdater(NULL) -{ -} - -LLSetKeyBindDialog::~LLSetKeyBindDialog() -{ -} - -//virtual -BOOL LLSetKeyBindDialog::postBuild() -{ - childSetAction("SetEmpty", onBlank, this); - childSetAction("Default", onDefault, this); - childSetAction("Cancel", onCancel, this); - getChild("Cancel")->setFocus(TRUE); - - pCheckBox = getChild("ignore_masks"); - - gFocusMgr.setKeystrokesOnly(TRUE); - - return TRUE; -} - -//virtual -void LLSetKeyBindDialog::onClose(bool app_quiting) -{ - if (pParent) - { - pParent->onCancelKeyBind(); - pParent = NULL; - } - if (pUpdater) - { - // Doubleclick timer has't fired, delete it - delete pUpdater; - pUpdater = NULL; - } - LLModalDialog::onClose(app_quiting); -} - -//virtual -void LLSetKeyBindDialog::draw() -{ - LLRect local_rect; - drawFrustum(local_rect, this, (LLView*)getDragHandle(), hasFocus()); - LLModalDialog::draw(); -} - -void LLSetKeyBindDialog::setParent(LLPanelPreferenceControls* parent, U32 key_mask) -{ - pParent = parent; - setFrustumOrigin(parent); - mKeyFilterMask = key_mask; - - LLTextBase *text_ctrl = getChild("descritption"); - - std::string input; - if ((key_mask & ALLOW_MOUSE) != 0) - { - input = getString("mouse"); - } - if ((key_mask & ALLOW_KEYS) != 0) - { - if (!input.empty()) - { - input += ", "; - } - input += getString("keyboard"); - } - text_ctrl->setTextArg("[INPUT]", input); - - bool can_ignore_masks = (key_mask & CAN_IGNORE_MASKS) != 0; - pCheckBox->setVisible(can_ignore_masks); - pCheckBox->setValue(false); -} - -BOOL LLSetKeyBindDialog::handleKeyHere(KEY key, MASK mask) -{ - if ((key == 'Q' && mask == MASK_CONTROL) - || key == KEY_ESCAPE) - { - closeFloater(); - return TRUE; - } - - if (key == KEY_DELETE) - { - setKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); - closeFloater(); - return FALSE; - } - - // forbidden keys - if (key == KEY_NONE - || key == KEY_RETURN - || key == KEY_BACKSPACE) - { - return FALSE; - } - - if ((mKeyFilterMask & ALLOW_MASKS) == 0 - && (key == KEY_CONTROL || key == KEY_SHIFT || key == KEY_ALT)) - { - // mask by themself are not allowed - return FALSE; - } - else if ((mKeyFilterMask & ALLOW_KEYS) == 0) - { - // basic keys not allowed - return FALSE; - } - else if ((mKeyFilterMask & ALLOW_MASK_KEYS) == 0 && mask != 0) - { - // masked keys not allowed - return FALSE; - } - - setKeyBind(CLICK_NONE, key, mask, pCheckBox->getValue().asBoolean()); - closeFloater(); - return TRUE; -} - -BOOL LLSetKeyBindDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) -{ - BOOL result = FALSE; - if (!pParent) - { - // we already processed 'down' event, this is 'up', consume - closeFloater(); - result = TRUE; - } - if (!result && clicktype == CLICK_LEFT) - { - // try handling buttons first - if (down) - { - result = LLView::handleMouseDown(x, y, mask); - } - else - { - result = LLView::handleMouseUp(x, y, mask); - } - if (result) - { - setFocus(TRUE); - gFocusMgr.setKeystrokesOnly(TRUE); - } - // ignore selection related combinations - else if (down && (mask & (MASK_SHIFT | MASK_CONTROL)) == 0) - { - // this can be a double click, wait a bit; - if (!pUpdater) - { - // Note: default doubleclick time is 500ms, but can stretch up to 5s - pUpdater = new Updater(boost::bind(&onClickTimeout, this, _1), 0.7f, mask); - result = TRUE; - } - } - } - - if (!result - && (clicktype != CLICK_LEFT) // subcases were handled above - && ((mKeyFilterMask & ALLOW_MOUSE) != 0) - && (clicktype != CLICK_RIGHT || mask != 0) // reassigning menu button is not supported - && ((mKeyFilterMask & ALLOW_MASK_MOUSE) != 0 || mask == 0)) // reserved for selection - { - setKeyBind(clicktype, KEY_NONE, mask, pCheckBox->getValue().asBoolean()); - result = TRUE; - if (!down) - { - // wait for 'up' event before closing - // alternative: set pUpdater - closeFloater(); - } - } - - return result; -} - -//static -void LLSetKeyBindDialog::onCancel(void* user_data) -{ - LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; - self->closeFloater(); -} - -//static -void LLSetKeyBindDialog::onBlank(void* user_data) -{ - LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; - // tmp needs 'no key' button - self->setKeyBind(CLICK_NONE, KEY_NONE, MASK_NONE, false); - self->closeFloater(); -} - -//static -void LLSetKeyBindDialog::onDefault(void* user_data) -{ - LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; - if (self->pParent) - { - self->pParent->onDefaultKeyBind(); - self->pParent = NULL; - } - self->closeFloater(); -} - -//static -void LLSetKeyBindDialog::onClickTimeout(void* user_data, MASK mask) -{ - LLSetKeyBindDialog* self = (LLSetKeyBindDialog*)user_data; - - // timer will delete itself after timeout - self->pUpdater = NULL; - - self->setKeyBind(CLICK_LEFT, KEY_NONE, mask, self->pCheckBox->getValue().asBoolean()); - self->closeFloater(); -} - -void LLSetKeyBindDialog::setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore) -{ - if (pParent) - { - pParent->onSetKeyBind(click, key, mask, ignore); - pParent = NULL; - } -} - // global functions @@ -3248,11 +2947,11 @@ void LLPanelPreferenceControls::onModeCommit() } // todo: copy onSetKeyBind to interface and inherit from interface -void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore_mask) +bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore_mask) { if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) { - return; + return true; } if ( mEditingColumn > 0) @@ -3261,6 +2960,7 @@ void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS } updateTable(); + return true; } void LLPanelPreferenceControls::onRestoreDefaults() -- cgit v1.2.3 From 6aab234105d6eed022afbea388ae21530c7e99dd Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 3 Oct 2019 22:45:29 +0300 Subject: SL-6109 Remade 'ignore' list processing, renamed and reformed keybindings --- indra/newview/llfloaterpreference.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6ee1bbee1a..61fd13f219 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2926,7 +2926,7 @@ void LLPanelPreferenceControls::onListCommit() { mEditingControl = control; mEditingColumn = cell_ind; - dialog->setParent(this, DEFAULT_KEY_FILTER); + dialog->setParent(this, pControlsTable, DEFAULT_KEY_FILTER); LLFloater* root_floater = gFloaterView->getParentFloater(this); if (root_floater) @@ -2946,6 +2946,14 @@ void LLPanelPreferenceControls::onModeCommit() regenerateControls(); } +void LLPanelPreferenceControls::onRestoreDefaults() +{ + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) + { + mConflictHandler[mEditingMode].resetToDefaults(); + } +} + // todo: copy onSetKeyBind to interface and inherit from interface bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore_mask) { @@ -2956,21 +2964,13 @@ bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS if ( mEditingColumn > 0) { - mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, ignore_mask); + mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true); } updateTable(); return true; } -void LLPanelPreferenceControls::onRestoreDefaults() -{ - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - mConflictHandler[mEditingMode].resetToDefaults(); - } -} - void LLPanelPreferenceControls::onDefaultKeyBind() { if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) -- cgit v1.2.3 From 317dd0e405dfb6ca813118c556f5c23af27cd2a7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 28 Oct 2019 17:52:31 +0200 Subject: SL-6109 - Fixed line endings in xml file - Removed obsolete UI element and it's code - Fixed issue with return value caused by rebase --- indra/newview/llfloaterpreference.cpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 61fd13f219..8328f9914e 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -285,7 +285,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); - mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); @@ -1571,21 +1570,6 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data) refresh(); } -void LLFloaterPreference::onClickSetMiddleMouse() -{ - LLUICtrl* p2t_line_editor = getChild("modifier_combo"); - - // update the control right away since we no longer wait for apply - p2t_line_editor->setControlValue(MIDDLE_MOUSE_CV); - - //push2talk button "middle mouse" control value is in English, need to localize it for presentation - LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); - if (advanced_preferences) - { - p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse")); - } -} - void LLFloaterPreference::onClickSetSounds() { // Disable Enable gesture sounds checkbox if the master sound is disabled @@ -2272,25 +2256,6 @@ BOOL LLPanelPreference::postBuild() getChild("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized)); } - //////////////////////PanelAdvanced /////////////////// - if (hasChild("modifier_combo", TRUE)) - { - //localizing if push2talk button is set to middle mouse - std::string modifier_value = getChild("modifier_combo")->getValue().asString(); - if (MIDDLE_MOUSE_CV == modifier_value) - { - getChild("modifier_combo")->setValue(getString("middle_mouse")); - } - else if (MOUSE_BUTTON_4_CV == modifier_value) - { - getChild("modifier_combo")->setValue(getString("button4_mouse")); - } - else if (MOUSE_BUTTON_5_CV == modifier_value) - { - getChild("modifier_combo")->setValue(getString("button5_mouse")); - } - } - //////////////////////PanelSetup /////////////////// if (hasChild("max_bandwidth"), TRUE) { -- cgit v1.2.3 From 8e734f543beb4bbfd4fb213e53d7fa8bc4302848 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 30 Oct 2019 20:48:54 +0200 Subject: SL-6109 Now changes are applied on the go and reverted on cancel --- indra/newview/llfloaterpreference.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 8328f9914e..9305f38a29 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2916,6 +2916,8 @@ void LLPanelPreferenceControls::onRestoreDefaults() for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { mConflictHandler[mEditingMode].resetToDefaults(); + // Apply changes to viewer as 'temporary' + mConflictHandler[mEditingMode].saveToSettings(true); } } @@ -2930,6 +2932,8 @@ bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS if ( mEditingColumn > 0) { mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true); + // Apply changes to viewer as 'temporary' + mConflictHandler[mEditingMode].saveToSettings(true); } updateTable(); @@ -2946,6 +2950,8 @@ void LLPanelPreferenceControls::onDefaultKeyBind() if (mEditingColumn > 0) { mConflictHandler[mEditingMode].resetToDefault(mEditingControl, mEditingColumn - 1); + // Apply changes to viewer as 'temporary' + mConflictHandler[mEditingMode].saveToSettings(true); } updateTable(); } -- cgit v1.2.3 From 65f2c039237b0c538134c17e7958090dc40d4559 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 4 Nov 2019 15:48:45 +0200 Subject: SL-6109 - Fixed defaults not restoring reliably - Fixed temporary changes not lifting reliably - Fixed switching modes was dropping changes to mode we switch to --- indra/newview/llfloaterpreference.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 9305f38a29..ffd83a8555 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2669,6 +2669,7 @@ LLPanelPreferenceControls::LLPanelPreferenceControls() mEditingColumn(-1), mEditingMode(0) { + // MODE_COUNT - 1 because there are currently no settings assigned to 'saved settings'. for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { mConflictHandler[i].setLoadMode((LLKeyConflictHandler::ESourceMode)i); @@ -2908,17 +2909,25 @@ void LLPanelPreferenceControls::onListCommit() void LLPanelPreferenceControls::onModeCommit() { - regenerateControls(); + mEditingMode = pKeyModeBox->getValue().asInteger(); + if (mConflictHandler[mEditingMode].empty()) + { + // opening for first time + mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::ESourceMode)mEditingMode); + } + populateControlTable(); } void LLPanelPreferenceControls::onRestoreDefaults() { for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) { - mConflictHandler[mEditingMode].resetToDefaults(); + mConflictHandler[i].resetToDefaults(); // Apply changes to viewer as 'temporary' - mConflictHandler[mEditingMode].saveToSettings(true); + mConflictHandler[i].saveToSettings(true); } + + updateTable(); } // todo: copy onSetKeyBind to interface and inherit from interface -- cgit v1.2.3 From 6ba0b97c851db7822e17a5a8dbb2d0964ca835f7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 7 Nov 2019 20:09:25 +0200 Subject: SL-6109 - Edit mode appears to be obsolete and is not used, cleaned up - Improved ability to set defaults - Improved some labels - Made buttons bigger to accomodate languages with longer descriptions - Added ability to assign key for all modes simultaneously --- indra/newview/llfloaterpreference.cpp | 85 ++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 16 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index ffd83a8555..98f4881eb6 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2688,7 +2688,7 @@ BOOL LLPanelPreferenceControls::postBuild() pControlsTable->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onListCommit, this)); pKeyModeBox->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onModeCommit, this)); - getChild("restore_defaults")->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onRestoreDefaults, this)); + getChild("restore_defaults")->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onRestoreDefaultsBtn, this)); return TRUE; } @@ -2710,7 +2710,6 @@ void LLPanelPreferenceControls::populateControlTable() { case LLKeyConflictHandler::MODE_THIRD_PERSON: case LLKeyConflictHandler::MODE_FIRST_PERSON: - case LLKeyConflictHandler::MODE_EDIT: case LLKeyConflictHandler::MODE_EDIT_AVATAR: case LLKeyConflictHandler::MODE_SITTING: filename = "control_table_contents.xml"; @@ -2918,20 +2917,42 @@ void LLPanelPreferenceControls::onModeCommit() populateControlTable(); } -void LLPanelPreferenceControls::onRestoreDefaults() +void LLPanelPreferenceControls::onRestoreDefaultsBtn() { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) + LLNotificationsUtil::add("PreferenceControlsDefaults", LLSD(), LLSD(), boost::bind(&LLPanelPreferenceControls::onRestoreDefaultsResponse, this, _1, _2)); +} + +void LLPanelPreferenceControls::onRestoreDefaultsResponse(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch(option) { - mConflictHandler[i].resetToDefaults(); + case 0: // All + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) + { + mConflictHandler[i].resetToDefaults(); + // Apply changes to viewer as 'temporary' + mConflictHandler[i].saveToSettings(true); + } + + updateTable(); + break; + case 1: // Current + mConflictHandler[mEditingMode].resetToDefaults(); // Apply changes to viewer as 'temporary' - mConflictHandler[i].saveToSettings(true); - } + mConflictHandler[mEditingMode].saveToSettings(true); - updateTable(); + updateTable(); + break; + case 2: // Cancel + default: + //exit; + break; + } } // todo: copy onSetKeyBind to interface and inherit from interface -bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore_mask) +bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes) { if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) { @@ -2940,16 +2961,32 @@ bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS if ( mEditingColumn > 0) { - mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true); - // Apply changes to viewer as 'temporary' - mConflictHandler[mEditingMode].saveToSettings(true); + if (all_modes) + { + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) + { + if (mConflictHandler[i].empty()) + { + mConflictHandler[i].loadFromSettings((LLKeyConflictHandler::ESourceMode)i); + } + mConflictHandler[i].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true); + // Apply changes to viewer as 'temporary' + mConflictHandler[i].saveToSettings(true); + } + } + else + { + mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true); + // Apply changes to viewer as 'temporary' + mConflictHandler[mEditingMode].saveToSettings(true); + } } updateTable(); return true; } -void LLPanelPreferenceControls::onDefaultKeyBind() +void LLPanelPreferenceControls::onDefaultKeyBind(bool all_modes) { if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) { @@ -2958,9 +2995,25 @@ void LLPanelPreferenceControls::onDefaultKeyBind() if (mEditingColumn > 0) { - mConflictHandler[mEditingMode].resetToDefault(mEditingControl, mEditingColumn - 1); - // Apply changes to viewer as 'temporary' - mConflictHandler[mEditingMode].saveToSettings(true); + if (all_modes) + { + for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) + { + if (mConflictHandler[i].empty()) + { + mConflictHandler[i].loadFromSettings((LLKeyConflictHandler::ESourceMode)i); + } + mConflictHandler[i].resetToDefault(mEditingControl, mEditingColumn - 1); + // Apply changes to viewer as 'temporary' + mConflictHandler[i].saveToSettings(true); + } + } + else + { + mConflictHandler[mEditingMode].resetToDefault(mEditingControl, mEditingColumn - 1); + // Apply changes to viewer as 'temporary' + mConflictHandler[mEditingMode].saveToSettings(true); + } } updateTable(); } -- cgit v1.2.3 From e8958a1c8921ec58653b1245be5dd767cfead6dd Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Sun, 10 Nov 2019 14:40:07 +0200 Subject: SL-6109 localization support for control table --- indra/newview/llfloaterpreference.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 98f4881eb6..05de782838 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2720,21 +2720,26 @@ void LLPanelPreferenceControls::populateControlTable() return; } - std::string full_filename = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, filename); - LLSimpleXUIParser parser; + LLXMLNodePtr xmlNode; LLScrollListCtrl::Contents contents; - if (!parser.readXUI(full_filename, contents) - || !contents.validateBlock()) + if (!LLUICtrlFactory::getLayeredXMLNode(filename, xmlNode)) + { + LL_WARNS() << "Failed to load " << filename << LL_ENDL; + return; + } + LLXUIParser parser; + parser.readXUI(xmlNode, contents, filename); + + if (!contents.validateBlock()) { - LL_INFOS() << "Failed to load" << LL_ENDL; return; } - for (LLInitParam::ParamIterator::const_iterator row_it = contents.columns.begin(); - row_it != contents.columns.end(); - ++row_it) + for (LLInitParam::ParamIterator::const_iterator col_it = contents.columns.begin(); + col_it != contents.columns.end(); + ++col_it) { - pControlsTable->addColumn(*row_it); + pControlsTable->addColumn(*col_it); } LLScrollListCell::Params cell_params; -- cgit v1.2.3 From 0bcb065623e7ce6ee956d0bc1c3321c6f0c02af6 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 13 Nov 2019 12:36:51 +0200 Subject: SL-12271 FIXED Notifications are cropped after moving them to the 'Never show' box --- indra/newview/llfloaterpreference.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 05de782838..390dea092d 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1136,12 +1136,12 @@ void LLFloaterPreference::buildPopupLists() if (it->second.asBoolean()) { row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString(); + row["columns"][1]["font"] = "SANSSERIF_SMALL"; + row["columns"][1]["width"] = 360; break; } } } - row["columns"][1]["font"] = "SANSSERIF_SMALL"; - row["columns"][1]["width"] = 360; } item = disabled_popups.addElement(row); } -- cgit v1.2.3 From b1f9de4d377c37d1e97f5ef06cbb438cdc755f6f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 12 Jun 2020 18:51:13 +0300 Subject: SL-13421 Removed camera control keybindings from mouselook --- indra/newview/llfloaterpreference.cpp | 116 ++++++++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 27 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index f7e984c14f..66f793a82c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2649,39 +2649,21 @@ void LLPanelPreferenceControls::regenerateControls() populateControlTable(); } -void LLPanelPreferenceControls::populateControlTable() +bool LLPanelPreferenceControls::addControlTableColumns(const std::string &filename) { - pControlsTable->clearRows(); - pControlsTable->clearColumns(); - - std::string filename; - switch ((LLKeyConflictHandler::ESourceMode)mEditingMode) - { - case LLKeyConflictHandler::MODE_THIRD_PERSON: - case LLKeyConflictHandler::MODE_FIRST_PERSON: - case LLKeyConflictHandler::MODE_EDIT_AVATAR: - case LLKeyConflictHandler::MODE_SITTING: - filename = "control_table_contents.xml"; - break; - default: - // 'saved settings' mode doesn't have UI or actual settings yet - LL_INFOS() << "Unimplemented mode" << LL_ENDL; - return; - } - LLXMLNodePtr xmlNode; LLScrollListCtrl::Contents contents; if (!LLUICtrlFactory::getLayeredXMLNode(filename, xmlNode)) { - LL_WARNS() << "Failed to load " << filename << LL_ENDL; - return; + LL_WARNS() << "Failed to load " << filename << LL_ENDL; + return false; } LLXUIParser parser; parser.readXUI(xmlNode, contents, filename); if (!contents.validateBlock()) { - return; + return false; } for (LLInitParam::ParamIterator::const_iterator col_it = contents.columns.begin(); @@ -2691,6 +2673,26 @@ void LLPanelPreferenceControls::populateControlTable() pControlsTable->addColumn(*col_it); } + return true; +} + +bool LLPanelPreferenceControls::addControlTableRows(const std::string &filename) +{ + LLXMLNodePtr xmlNode; + LLScrollListCtrl::Contents contents; + if (!LLUICtrlFactory::getLayeredXMLNode(filename, xmlNode)) + { + LL_WARNS() << "Failed to load " << filename << LL_ENDL; + return false; + } + LLXUIParser parser; + parser.readXUI(xmlNode, contents, filename); + + if (!contents.validateBlock()) + { + return false; + } + LLScrollListCell::Params cell_params; // init basic cell params cell_params.font = LLFontGL::getFontSansSerif(); @@ -2706,7 +2708,7 @@ void LLPanelPreferenceControls::populateControlTable() std::string control = row_it->value.getValue().asString(); if (!control.empty() && control != "menu_separator") { - // At the moment 4 collumns are hardcoded + // At the moment viewer is hardcoded to assume that there are 4 collumns LLScrollListItem::Params item_params(*row_it); bool enabled = mConflictHandler[mEditingMode].canAssignControl(control); item_params.enabled.setValue(enabled); @@ -2723,17 +2725,77 @@ void LLPanelPreferenceControls::populateControlTable() } else { + // Separator example: + // + // + // pControlsTable->addRow(*row_it, EAddPosition::ADD_BOTTOM); } } + return true; +} + +void LLPanelPreferenceControls::addControlTableSeparator() +{ + pControlsTable->addSeparator(EAddPosition::ADD_BOTTOM); } -// Just a workaround to not care about first separator before headers (we can start from random header) -void LLPanelPreferenceControls::addSeparator() +void LLPanelPreferenceControls::populateControlTable() { - if (pControlsTable->getItemCount() > 0) + pControlsTable->clearRows(); + pControlsTable->clearColumns(); + + // add columns + std::string filename; + switch ((LLKeyConflictHandler::ESourceMode)mEditingMode) { - pControlsTable->addSeparator(EAddPosition::ADD_BOTTOM); + case LLKeyConflictHandler::MODE_THIRD_PERSON: + case LLKeyConflictHandler::MODE_FIRST_PERSON: + case LLKeyConflictHandler::MODE_EDIT_AVATAR: + case LLKeyConflictHandler::MODE_SITTING: + filename = "control_table_contents_columns_basic.xml"; + break; + default: + // Either unknown mode or MODE_SAVED_SETTINGS + // It doesn't have UI or actual settings yet + LL_INFOS() << "Unimplemented mode" << LL_ENDL; + return; + } + addControlTableColumns(filename); + + switch ((LLKeyConflictHandler::ESourceMode)mEditingMode) + { + case LLKeyConflictHandler::MODE_FIRST_PERSON: + addControlTableRows("control_table_contents_movement.xml"); + addControlTableSeparator(); + addControlTableRows("control_table_contents_media.xml"); + break; + case LLKeyConflictHandler::MODE_THIRD_PERSON: + case LLKeyConflictHandler::MODE_EDIT_AVATAR: + case LLKeyConflictHandler::MODE_SITTING: + addControlTableRows("control_table_contents_movement.xml"); + addControlTableSeparator(); + + // contains couple 'sitting' options, might be good idea to recheck + // those and move to own group with sitting/spinning icon + addControlTableRows("control_table_contents_camera.xml"); + addControlTableSeparator(); + + // Do we need this outside of MODE_EDIT_AVATAR? + addControlTableRows("control_table_contents_editing.xml"); + addControlTableSeparator(); + + addControlTableRows("control_table_contents_media.xml"); + break; + default: + // 'saved settings' mode doesn't have UI or actual settings yet + LL_INFOS() << "Unimplemented mode" << LL_ENDL; + return; } } -- cgit v1.2.3 From ceea2df59634ab09d165943bd7591e7125ee0f80 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 12 Jun 2020 20:09:43 +0300 Subject: SL-13421 Separated some sitting-exclusive controls --- indra/newview/llfloaterpreference.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 66f793a82c..dc5905b6e7 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2768,32 +2768,34 @@ void LLPanelPreferenceControls::populateControlTable() } addControlTableColumns(filename); - switch ((LLKeyConflictHandler::ESourceMode)mEditingMode) + + if (mEditingMode == LLKeyConflictHandler::MODE_FIRST_PERSON) { - case LLKeyConflictHandler::MODE_FIRST_PERSON: addControlTableRows("control_table_contents_movement.xml"); addControlTableSeparator(); addControlTableRows("control_table_contents_media.xml"); - break; - case LLKeyConflictHandler::MODE_THIRD_PERSON: - case LLKeyConflictHandler::MODE_EDIT_AVATAR: - case LLKeyConflictHandler::MODE_SITTING: + } + // MODE_THIRD_PERSON; MODE_EDIT_AVATAR; MODE_SITTING + else if (mEditingMode < LLKeyConflictHandler::MODE_SAVED_SETTINGS) + { + // In case of 'sitting' mode, movements still apply due to vehicles addControlTableRows("control_table_contents_movement.xml"); addControlTableSeparator(); - // contains couple 'sitting' options, might be good idea to recheck - // those and move to own group with sitting/spinning icon - addControlTableRows("control_table_contents_camera.xml"); + addControlTableRows("control_table_contents_camera.xml"); + if (mEditingMode == LLKeyConflictHandler::MODE_SITTING) + { + addControlTableRows("control_table_contents_camera_sitting.xml"); + } addControlTableSeparator(); - // Do we need this outside of MODE_EDIT_AVATAR? addControlTableRows("control_table_contents_editing.xml"); addControlTableSeparator(); addControlTableRows("control_table_contents_media.xml"); - break; - default: - // 'saved settings' mode doesn't have UI or actual settings yet + } + else + { LL_INFOS() << "Unimplemented mode" << LL_ENDL; return; } -- cgit v1.2.3 From b291bc32e96bf5eab50df74d118ba61c924c67fa Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 15 Jun 2020 20:35:58 +0300 Subject: SL-13418 Restored previously removed 'click on land' controls from 'move & view' According to UX UI engineer. Also adapted it to new system, but it needs a better solution. --- indra/newview/llfloaterpreference.cpp | 212 +++++++++++++++++++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index dc5905b6e7..ed28756473 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -311,6 +311,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) sSkin = gSavedSettings.getString("SkinCurrent"); + mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); + gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); @@ -609,6 +611,8 @@ void LLFloaterPreference::cancel() // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); + updateClickActionViews(); + LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); if (advanced_proxy_settings) { @@ -690,6 +694,9 @@ void LLFloaterPreference::onOpen(const LLSD& key) onChangeTextureFolder(); onChangeSoundFolder(); onChangeAnimationFolder(); + + // Load (double-)click to walk/teleport settings. + updateClickActionViews(); // Enabled/disabled popups, might have been changed by user actions // while preferences floater was closed. @@ -1486,6 +1493,7 @@ void LLFloaterPreference::refresh() { advanced->refresh(); } + updateClickActionViews(); } void LLFloaterPreferenceGraphicsAdvanced::refresh() @@ -1995,6 +2003,11 @@ void LLFloaterPreference::onClickAdvanced() } } +void LLFloaterPreference::onClickActionChange() +{ + updateClickActionControls(); +} + void LLFloaterPreference::onClickPermsDefault() { LLFloaterReg::showInstance("perms_default"); @@ -2032,6 +2045,86 @@ void LLFloaterPreference::onLogChatHistorySaved() } } +void LLFloaterPreference::updateClickActionControls() +{ + const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); + const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); + + // Todo: This is a very ugly way to get access to keybindings. + // Reconsider possible options. + // Potential option: make constructor of LLKeyConflictHandler private + // but add a getter that will return shared pointer for specific + // mode, pointer should only exist so long as there are external users. + // In such case we won't need to do this 'dynamic_cast' nightmare. + // updateTable() can also be avoided + LLTabContainer* tabcontainer = getChild("pref core"); + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreferenceControls* panel = dynamic_cast(view); + if (panel) + { + panel->setKeyBind("walk_to", + EMouseClickType::CLICK_LEFT, + KEY_NONE, + MASK_NONE, + single_clk_action == 1); + + panel->setKeyBind("walk_to", + EMouseClickType::CLICK_DOUBLELEFT, + KEY_NONE, + MASK_NONE, + double_clk_action == 1); + + panel->setKeyBind("teleport_to", + EMouseClickType::CLICK_DOUBLELEFT, + KEY_NONE, + MASK_NONE, + double_clk_action == 2); + + panel->updateTable(); + } + } +} + +void LLFloaterPreference::updateClickActionViews() +{ + bool click_to_walk = false; + bool dbl_click_to_walk = false; + bool dbl_click_to_teleport = false; + + // Todo: This is a very ugly way to get access to keybindings. + // Reconsider possible options. + LLTabContainer* tabcontainer = getChild("pref core"); + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + LLPanelPreferenceControls* panel = dynamic_cast(view); + if (panel) + { + click_to_walk = panel->canKeyBindHandle("walk_to", + EMouseClickType::CLICK_LEFT, + KEY_NONE, + MASK_NONE); + + dbl_click_to_walk = panel->canKeyBindHandle("walk_to", + EMouseClickType::CLICK_DOUBLELEFT, + KEY_NONE, + MASK_NONE); + + dbl_click_to_teleport = panel->canKeyBindHandle("teleport_to", + EMouseClickType::CLICK_DOUBLELEFT, + KEY_NONE, + MASK_NONE); + } + } + + getChild("single_click_action_combo")->setValue((int)click_to_walk); + getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); +} + void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); @@ -2856,7 +2949,7 @@ void LLPanelPreferenceControls::saveSettings() } S32 mode = pKeyModeBox->getValue().asInteger(); - if (mConflictHandler[mode].empty()) + if (mConflictHandler[mode].empty() || pControlsTable->isEmpty()) { regenerateControls(); } @@ -2951,6 +3044,13 @@ void LLPanelPreferenceControls::onRestoreDefaultsResponse(const LLSD& notificati mConflictHandler[i].resetToDefaults(); // Apply changes to viewer as 'temporary' mConflictHandler[i].saveToSettings(true); + + // notify comboboxes in move&view about potential change + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->updateClickActionViews(); + } } updateTable(); @@ -2960,6 +3060,16 @@ void LLPanelPreferenceControls::onRestoreDefaultsResponse(const LLSD& notificati // Apply changes to viewer as 'temporary' mConflictHandler[mEditingMode].saveToSettings(true); + if (mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON) + { + // notify comboboxes in move&view about potential change + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->updateClickActionViews(); + } + } + updateTable(); break; case 2: // Cancel @@ -2969,7 +3079,80 @@ void LLPanelPreferenceControls::onRestoreDefaultsResponse(const LLSD& notificati } } -// todo: copy onSetKeyBind to interface and inherit from interface +// Bypass to let Move & view read values without need to create own key binding handler +// Assumes third person view +// Might be better idea to just move whole mConflictHandler into LLFloaterPreference +bool LLPanelPreferenceControls::canKeyBindHandle(const std::string &control, EMouseClickType click, KEY key, MASK mask) +{ + S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON; + if (mConflictHandler[mode].empty()) + { + // opening for first time + mConflictHandler[mode].loadFromSettings(LLKeyConflictHandler::MODE_THIRD_PERSON); + } + + return mConflictHandler[mode].canHandleControl(control, click, key, mask); +} + +// Bypass to let Move & view modify values without need to create own key binding handler +// Assumes third person view +// Might be better idea to just move whole mConflictHandler into LLFloaterPreference +void LLPanelPreferenceControls::setKeyBind(const std::string &control, EMouseClickType click, KEY key, MASK mask, bool set) +{ + S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON; + if (mConflictHandler[mode].empty()) + { + // opening for first time + mConflictHandler[mode].loadFromSettings(LLKeyConflictHandler::MODE_THIRD_PERSON); + } + + if (!mConflictHandler[mode].canAssignControl(mEditingControl)) + { + return; + } + + bool already_recorded = mConflictHandler[mode].canHandleControl(control, click, key, mask); + if (set) + { + if (already_recorded) + { + // nothing to do + return; + } + + // find free spot to add data, if no free spot, assign to first + S32 index = 0; + for (S32 i = 0; i < 3; i++) + { + if (mConflictHandler[mode].getControl(control, i).isEmpty()) + { + index = i; + break; + } + } + mConflictHandler[mode].registerControl(control, index, click, key, mask, true); + } + else if (!set) + { + if (!already_recorded) + { + // nothing to do + return; + } + + // find specific control and reset it + for (S32 i = 0; i < 3; i++) + { + LLKeyData data = mConflictHandler[mode].getControl(control, i); + if (data.mMouse == click && data.mKey == key && data.mMask == mask) + { + mConflictHandler[mode].clearControl(control, i); + } + } + } +} + +// from LLSetKeybindDialog's interface bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes) { if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) @@ -3001,6 +3184,21 @@ bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MAS } updateTable(); + + if ((mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON || all_modes) + && (mEditingControl == "walk_to" + || mEditingControl == "teleport_to" + || click == CLICK_LEFT + || click == CLICK_DOUBLELEFT)) + { + // notify comboboxes in move&view about potential change + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->updateClickActionViews(); + } + } + return true; } @@ -3034,6 +3232,16 @@ void LLPanelPreferenceControls::onDefaultKeyBind(bool all_modes) } } updateTable(); + + if (mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON || all_modes) + { + // notify comboboxes in move&view about potential change + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->updateClickActionViews(); + } + } } void LLPanelPreferenceControls::onCancelKeyBind() -- cgit v1.2.3 From 71b66c758e52f6ad79392942646d8db021897dea Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 16 Jun 2020 09:27:41 +0300 Subject: SL-13418 Move and view panel now applies changes on the go --- indra/newview/llfloaterpreference.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index ed28756473..a1d3c65289 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2083,7 +2083,7 @@ void LLFloaterPreference::updateClickActionControls() MASK_NONE, double_clk_action == 2); - panel->updateTable(); + panel->updateAndApply(); } } } @@ -3152,6 +3152,13 @@ void LLPanelPreferenceControls::setKeyBind(const std::string &control, EMouseCli } } +void LLPanelPreferenceControls::updateAndApply() +{ + S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON; + mConflictHandler[mode].saveToSettings(true); + updateTable(); +} + // from LLSetKeybindDialog's interface bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes) { -- cgit v1.2.3 From 1b744fb2a64f04332590b566783da2f955005414 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 17 Jun 2020 09:51:05 +0300 Subject: SL-13469 Fixed use of wrong clear function --- indra/newview/llfloaterpreference.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index a1d3c65289..91a3ae384d 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2934,7 +2934,8 @@ void LLPanelPreferenceControls::cancel() mConflictHandler[i].clear(); } } - pControlsTable->clear(); + pControlsTable->clearRows(); + pControlsTable->clearColumns(); } void LLPanelPreferenceControls::saveSettings() -- cgit v1.2.3 From f8137f68a0f157c7dc7766a695a62d59b4198291 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 23 Jun 2020 16:16:11 +0300 Subject: Reverted SL-6109 keybinding changes Changes were moved to DRTVWR-514 --- indra/newview/llfloaterpreference.cpp | 874 ++++++++++------------------------ 1 file changed, 240 insertions(+), 634 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 91a3ae384d..81f4b2234c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -71,9 +71,8 @@ #include "lltrans.h" #include "llviewercontrol.h" #include "llviewercamera.h" -#include "llviewereventrecorder.h" -#include "llviewermessage.h" #include "llviewerwindow.h" +#include "llviewermessage.h" #include "llviewershadermgr.h" #include "llviewerthrottle.h" #include "llvoavatarself.h" @@ -160,6 +159,87 @@ struct LabelTable : public LLInitParam::Block {} }; +class LLVoiceSetKeyDialog : public LLModalDialog +{ +public: + LLVoiceSetKeyDialog(const LLSD& key); + ~LLVoiceSetKeyDialog(); + + /*virtual*/ BOOL postBuild(); + + void setParent(LLFloaterPreference* parent) { mParent = parent; } + + BOOL handleKeyHere(KEY key, MASK mask); + BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); + static void onCancel(void* user_data); + +private: + LLFloaterPreference* mParent; +}; + +LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key) + : LLModalDialog(key), + mParent(NULL) +{ +} + +//virtual +BOOL LLVoiceSetKeyDialog::postBuild() +{ + childSetAction("Cancel", onCancel, this); + getChild("Cancel")->setFocus(TRUE); + + gFocusMgr.setKeystrokesOnly(TRUE); + + return TRUE; +} + +LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() +{ +} + +BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) +{ + BOOL result = TRUE; + + if (key == 'Q' && mask == MASK_CONTROL) + { + result = FALSE; + } + else if (mParent) + { + mParent->setKey(key); + } + closeFloater(); + return result; +} + +BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) +{ + BOOL result = FALSE; + if (down + && (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5) + && mask == 0) + { + mParent->setMouse(clicktype); + result = TRUE; + closeFloater(); + } + else + { + result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); + } + + return result; +} + +//static +void LLVoiceSetKeyDialog::onCancel(void* user_data) +{ + LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; + self->closeFloater(); +} + // global functions @@ -239,6 +319,37 @@ void handleAppearanceCameraMovementChanged(const LLSD& newvalue) } } +/*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option && floater ) + { + if ( floater ) + { + floater->setAllIgnored(); + // LLFirstUse::disableFirstUse(); + floater->buildPopupLists(); + } + } + return false; +} + +bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( 0 == option && floater ) + { + if ( floater ) + { + floater->resetAllIgnored(); + //LLFirstUse::resetFirstUse(); + floater->buildPopupLists(); + } + } + return false; +} +*/ + void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { numerator = 0; @@ -263,7 +374,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mGotPersonalInfo(false), mOriginalIMViaEmail(false), mLanguageChanged(false), - mAvatarDataInitialized(false) + mAvatarDataInitialized(false), + mClickActionDirty(false) { LLConversationLog::instance().addObserver(this); @@ -272,7 +384,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) static bool registered_dialog = false; if (!registered_dialog) { - LLFloaterReg::add("keybind_dialog", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); registered_dialog = true; } @@ -285,6 +397,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this)); mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); @@ -579,6 +693,12 @@ void LLFloaterPreference::apply() } saveAvatarProperties(); + + if (mClickActionDirty) + { + updateClickActionSettings(); + mClickActionDirty = false; + } } void LLFloaterPreference::cancel() @@ -611,7 +731,11 @@ void LLFloaterPreference::cancel() // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); - updateClickActionViews(); + if (mClickActionDirty) + { + updateClickActionControls(); + mClickActionDirty = false; + } LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance("prefs_proxy"); if (advanced_proxy_settings) @@ -696,7 +820,7 @@ void LLFloaterPreference::onOpen(const LLSD& key) onChangeAnimationFolder(); // Load (double-)click to walk/teleport settings. - updateClickActionViews(); + updateClickActionControls(); // Enabled/disabled popups, might have been changed by user actions // while preferences floater was closed. @@ -1493,7 +1617,6 @@ void LLFloaterPreference::refresh() { advanced->refresh(); } - updateClickActionViews(); } void LLFloaterPreferenceGraphicsAdvanced::refresh() @@ -1535,6 +1658,72 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data) refresh(); } +void LLFloaterPreference::onClickSetKey() +{ + LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance("voice_set_key", LLSD(), TRUE); + if (dialog) + { + dialog->setParent(this); + } +} + +void LLFloaterPreference::setKey(KEY key) +{ + getChild("modifier_combo")->setValue(LLKeyboard::stringFromKey(key)); + // update the control right away since we no longer wait for apply + getChild("modifier_combo")->onCommit(); +} + +void LLFloaterPreference::setMouse(LLMouseHandler::EClickType click) +{ + std::string bt_name; + std::string ctrl_value; + switch (click) + { + case LLMouseHandler::CLICK_MIDDLE: + bt_name = "middle_mouse"; + ctrl_value = MIDDLE_MOUSE_CV; + break; + case LLMouseHandler::CLICK_BUTTON4: + bt_name = "button4_mouse"; + ctrl_value = MOUSE_BUTTON_4_CV; + break; + case LLMouseHandler::CLICK_BUTTON5: + bt_name = "button5_mouse"; + ctrl_value = MOUSE_BUTTON_5_CV; + break; + default: + break; + } + + if (!ctrl_value.empty()) + { + LLUICtrl* p2t_line_editor = getChild("modifier_combo"); + // We are using text control names for readability and compatibility with voice + p2t_line_editor->setControlValue(ctrl_value); + LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); + if (advanced_preferences) + { + p2t_line_editor->setValue(advanced_preferences->getString(bt_name)); + } + } +} + +void LLFloaterPreference::onClickSetMiddleMouse() +{ + LLUICtrl* p2t_line_editor = getChild("modifier_combo"); + + // update the control right away since we no longer wait for apply + p2t_line_editor->setControlValue(MIDDLE_MOUSE_CV); + + //push2talk button "middle mouse" control value is in English, need to localize it for presentation + LLPanel* advanced_preferences = dynamic_cast(p2t_line_editor->getParent()); + if (advanced_preferences) + { + p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse")); + } +} + void LLFloaterPreference::onClickSetSounds() { // Disable Enable gesture sounds checkbox if the master sound is disabled @@ -1542,6 +1731,18 @@ void LLFloaterPreference::onClickSetSounds() getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); } +/* +void LLFloaterPreference::onClickSkipDialogs() +{ + LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); +} + +void LLFloaterPreference::onClickResetDialogs() +{ + LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); +} + */ + void LLFloaterPreference::onClickEnablePopup() { LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); @@ -2005,7 +2206,7 @@ void LLFloaterPreference::onClickAdvanced() void LLFloaterPreference::onClickActionChange() { - updateClickActionControls(); + mClickActionDirty = true; } void LLFloaterPreference::onClickPermsDefault() @@ -2045,81 +2246,21 @@ void LLFloaterPreference::onLogChatHistorySaved() } } -void LLFloaterPreference::updateClickActionControls() +void LLFloaterPreference::updateClickActionSettings() { - const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); - const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); - - // Todo: This is a very ugly way to get access to keybindings. - // Reconsider possible options. - // Potential option: make constructor of LLKeyConflictHandler private - // but add a getter that will return shared pointer for specific - // mode, pointer should only exist so long as there are external users. - // In such case we won't need to do this 'dynamic_cast' nightmare. - // updateTable() can also be avoided - LLTabContainer* tabcontainer = getChild("pref core"); - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreferenceControls* panel = dynamic_cast(view); - if (panel) - { - panel->setKeyBind("walk_to", - EMouseClickType::CLICK_LEFT, - KEY_NONE, - MASK_NONE, - single_clk_action == 1); - - panel->setKeyBind("walk_to", - EMouseClickType::CLICK_DOUBLELEFT, - KEY_NONE, - MASK_NONE, - double_clk_action == 1); - - panel->setKeyBind("teleport_to", - EMouseClickType::CLICK_DOUBLELEFT, - KEY_NONE, - MASK_NONE, - double_clk_action == 2); - - panel->updateAndApply(); - } - } + const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); + const int double_clk_action = getChild("double_click_action_combo")->getValue().asInteger(); + + gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); } -void LLFloaterPreference::updateClickActionViews() +void LLFloaterPreference::updateClickActionControls() { - bool click_to_walk = false; - bool dbl_click_to_walk = false; - bool dbl_click_to_teleport = false; - - // Todo: This is a very ugly way to get access to keybindings. - // Reconsider possible options. - LLTabContainer* tabcontainer = getChild("pref core"); - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - LLPanelPreferenceControls* panel = dynamic_cast(view); - if (panel) - { - click_to_walk = panel->canKeyBindHandle("walk_to", - EMouseClickType::CLICK_LEFT, - KEY_NONE, - MASK_NONE); - - dbl_click_to_walk = panel->canKeyBindHandle("walk_to", - EMouseClickType::CLICK_DOUBLELEFT, - KEY_NONE, - MASK_NONE); - - dbl_click_to_teleport = panel->canKeyBindHandle("teleport_to", - EMouseClickType::CLICK_DOUBLELEFT, - KEY_NONE, - MASK_NONE); - } - } + const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); + const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); + const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); getChild("single_click_action_combo")->setValue((int)click_to_walk); getChild("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk); @@ -2306,6 +2447,25 @@ BOOL LLPanelPreference::postBuild() getChild("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized)); } + //////////////////////PanelAdvanced /////////////////// + if (hasChild("modifier_combo", TRUE)) + { + //localizing if push2talk button is set to middle mouse + std::string modifier_value = getChild("modifier_combo")->getValue().asString(); + if (MIDDLE_MOUSE_CV == modifier_value) + { + getChild("modifier_combo")->setValue(getString("middle_mouse")); + } + else if (MOUSE_BUTTON_4_CV == modifier_value) + { + getChild("modifier_combo")->setValue(getString("button4_mouse")); + } + else if (MOUSE_BUTTON_5_CV == modifier_value) + { + getChild("modifier_combo")->setValue(getString("button5_mouse")); + } + } + //////////////////////PanelSetup /////////////////// if (hasChild("max_bandwidth"), TRUE) { @@ -2583,7 +2743,7 @@ void LLPanelPreferenceGraphics::setPresetText() } } - if (hasDirtyChilds() && !preset_graphic_active.empty()) + if (hasDirtyChilds() && !preset_graphic_active.empty()) { gSavedSettings.setString("PresetGraphicActive", ""); preset_graphic_active.clear(); @@ -2703,560 +2863,6 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() resetDirtyChilds(); } -//------------------------LLPanelPreferenceControls-------------------------------- -static LLPanelInjector t_pref_contrls("panel_preference_controls"); - -LLPanelPreferenceControls::LLPanelPreferenceControls() - :LLPanelPreference(), - mEditingColumn(-1), - mEditingMode(0) -{ - // MODE_COUNT - 1 because there are currently no settings assigned to 'saved settings'. - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - mConflictHandler[i].setLoadMode((LLKeyConflictHandler::ESourceMode)i); - } -} - -LLPanelPreferenceControls::~LLPanelPreferenceControls() -{ -} - -BOOL LLPanelPreferenceControls::postBuild() -{ - // populate list of controls - pControlsTable = getChild("controls_list"); - pKeyModeBox = getChild("key_mode"); - - pControlsTable->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onListCommit, this)); - pKeyModeBox->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onModeCommit, this)); - getChild("restore_defaults")->setCommitCallback(boost::bind(&LLPanelPreferenceControls::onRestoreDefaultsBtn, this)); - - return TRUE; -} - -void LLPanelPreferenceControls::regenerateControls() -{ - mEditingMode = pKeyModeBox->getValue().asInteger(); - mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::ESourceMode)mEditingMode); - populateControlTable(); -} - -bool LLPanelPreferenceControls::addControlTableColumns(const std::string &filename) -{ - LLXMLNodePtr xmlNode; - LLScrollListCtrl::Contents contents; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, xmlNode)) - { - LL_WARNS() << "Failed to load " << filename << LL_ENDL; - return false; - } - LLXUIParser parser; - parser.readXUI(xmlNode, contents, filename); - - if (!contents.validateBlock()) - { - return false; - } - - for (LLInitParam::ParamIterator::const_iterator col_it = contents.columns.begin(); - col_it != contents.columns.end(); - ++col_it) - { - pControlsTable->addColumn(*col_it); - } - - return true; -} - -bool LLPanelPreferenceControls::addControlTableRows(const std::string &filename) -{ - LLXMLNodePtr xmlNode; - LLScrollListCtrl::Contents contents; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, xmlNode)) - { - LL_WARNS() << "Failed to load " << filename << LL_ENDL; - return false; - } - LLXUIParser parser; - parser.readXUI(xmlNode, contents, filename); - - if (!contents.validateBlock()) - { - return false; - } - - LLScrollListCell::Params cell_params; - // init basic cell params - cell_params.font = LLFontGL::getFontSansSerif(); - cell_params.font_halign = LLFontGL::LEFT; - cell_params.column = ""; - cell_params.value = ""; - - - for (LLInitParam::ParamIterator::const_iterator row_it = contents.rows.begin(); - row_it != contents.rows.end(); - ++row_it) - { - std::string control = row_it->value.getValue().asString(); - if (!control.empty() && control != "menu_separator") - { - // At the moment viewer is hardcoded to assume that there are 4 collumns - LLScrollListItem::Params item_params(*row_it); - bool enabled = mConflictHandler[mEditingMode].canAssignControl(control); - item_params.enabled.setValue(enabled); - cell_params.column = "lst_ctrl1"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 0); - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl2"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 1); - item_params.columns.add(cell_params); - cell_params.column = "lst_ctrl3"; - cell_params.value = mConflictHandler[mEditingMode].getControlString(control, 2); - item_params.columns.add(cell_params); - pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM); - } - else - { - // Separator example: - // - // - // - pControlsTable->addRow(*row_it, EAddPosition::ADD_BOTTOM); - } - } - return true; -} - -void LLPanelPreferenceControls::addControlTableSeparator() -{ - pControlsTable->addSeparator(EAddPosition::ADD_BOTTOM); -} - -void LLPanelPreferenceControls::populateControlTable() -{ - pControlsTable->clearRows(); - pControlsTable->clearColumns(); - - // add columns - std::string filename; - switch ((LLKeyConflictHandler::ESourceMode)mEditingMode) - { - case LLKeyConflictHandler::MODE_THIRD_PERSON: - case LLKeyConflictHandler::MODE_FIRST_PERSON: - case LLKeyConflictHandler::MODE_EDIT_AVATAR: - case LLKeyConflictHandler::MODE_SITTING: - filename = "control_table_contents_columns_basic.xml"; - break; - default: - // Either unknown mode or MODE_SAVED_SETTINGS - // It doesn't have UI or actual settings yet - LL_INFOS() << "Unimplemented mode" << LL_ENDL; - return; - } - addControlTableColumns(filename); - - - if (mEditingMode == LLKeyConflictHandler::MODE_FIRST_PERSON) - { - addControlTableRows("control_table_contents_movement.xml"); - addControlTableSeparator(); - addControlTableRows("control_table_contents_media.xml"); - } - // MODE_THIRD_PERSON; MODE_EDIT_AVATAR; MODE_SITTING - else if (mEditingMode < LLKeyConflictHandler::MODE_SAVED_SETTINGS) - { - // In case of 'sitting' mode, movements still apply due to vehicles - addControlTableRows("control_table_contents_movement.xml"); - addControlTableSeparator(); - - addControlTableRows("control_table_contents_camera.xml"); - if (mEditingMode == LLKeyConflictHandler::MODE_SITTING) - { - addControlTableRows("control_table_contents_camera_sitting.xml"); - } - addControlTableSeparator(); - - addControlTableRows("control_table_contents_editing.xml"); - addControlTableSeparator(); - - addControlTableRows("control_table_contents_media.xml"); - } - else - { - LL_INFOS() << "Unimplemented mode" << LL_ENDL; - return; - } -} - -void LLPanelPreferenceControls::updateTable() -{ - mEditingControl.clear(); - std::vector list = pControlsTable->getAllData(); - for (S32 i = 0; i < list.size(); ++i) - { - std::string control = list[i]->getValue(); - if (!control.empty()) - { - LLScrollListCell* cell = list[i]->getColumn(1); - cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 0)); - cell = list[i]->getColumn(2); - cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 1)); - cell = list[i]->getColumn(3); - cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2)); - } - } - pControlsTable->deselectAllItems(); -} - -void LLPanelPreferenceControls::apply() -{ - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - if (mConflictHandler[i].hasUnsavedChanges()) - { - mConflictHandler[i].saveToSettings(); - } - } -} - -void LLPanelPreferenceControls::cancel() -{ - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - if (mConflictHandler[i].hasUnsavedChanges()) - { - mConflictHandler[i].clear(); - } - } - pControlsTable->clearRows(); - pControlsTable->clearColumns(); -} - -void LLPanelPreferenceControls::saveSettings() -{ - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - if (mConflictHandler[i].hasUnsavedChanges()) - { - mConflictHandler[i].saveToSettings(); - mConflictHandler[i].clear(); - } - } - - S32 mode = pKeyModeBox->getValue().asInteger(); - if (mConflictHandler[mode].empty() || pControlsTable->isEmpty()) - { - regenerateControls(); - } -} - -void LLPanelPreferenceControls::resetDirtyChilds() -{ - regenerateControls(); -} - -void LLPanelPreferenceControls::onListCommit() -{ - LLScrollListItem* item = pControlsTable->getFirstSelected(); - if (item == NULL) - { - return; - } - - std::string control = item->getValue(); - - if (control.empty()) - { - pControlsTable->deselectAllItems(); - return; - } - - if (!mConflictHandler[mEditingMode].canAssignControl(control)) - { - pControlsTable->deselectAllItems(); - return; - } - - S32 cell_ind = item->getSelectedCell(); - if (cell_ind <= 0) - { - pControlsTable->deselectAllItems(); - return; - } - - // List does not tell us what cell was clicked, so we have to figure it out manually, but - // fresh mouse coordinates are not yet accessible during onCommit() and there are other issues, - // so we cheat: remember item user clicked at, trigger 'key dialog' on hover that comes next, - // use coordinates from hover to calculate cell - - LLScrollListCell* cell = item->getColumn(cell_ind); - if (cell) - { - LLSetKeyBindDialog* dialog = LLFloaterReg::getTypedInstance("keybind_dialog", LLSD()); - if (dialog) - { - mEditingControl = control; - mEditingColumn = cell_ind; - dialog->setParent(this, pControlsTable, DEFAULT_KEY_FILTER); - - LLFloater* root_floater = gFloaterView->getParentFloater(this); - if (root_floater) - root_floater->addDependentFloater(dialog); - dialog->openFloater(); - dialog->setFocus(TRUE); - } - } - else - { - pControlsTable->deselectAllItems(); - } -} - -void LLPanelPreferenceControls::onModeCommit() -{ - mEditingMode = pKeyModeBox->getValue().asInteger(); - if (mConflictHandler[mEditingMode].empty()) - { - // opening for first time - mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::ESourceMode)mEditingMode); - } - populateControlTable(); -} - -void LLPanelPreferenceControls::onRestoreDefaultsBtn() -{ - LLNotificationsUtil::add("PreferenceControlsDefaults", LLSD(), LLSD(), boost::bind(&LLPanelPreferenceControls::onRestoreDefaultsResponse, this, _1, _2)); -} - -void LLPanelPreferenceControls::onRestoreDefaultsResponse(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - switch(option) - { - case 0: // All - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - mConflictHandler[i].resetToDefaults(); - // Apply changes to viewer as 'temporary' - mConflictHandler[i].saveToSettings(true); - - // notify comboboxes in move&view about potential change - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->updateClickActionViews(); - } - } - - updateTable(); - break; - case 1: // Current - mConflictHandler[mEditingMode].resetToDefaults(); - // Apply changes to viewer as 'temporary' - mConflictHandler[mEditingMode].saveToSettings(true); - - if (mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON) - { - // notify comboboxes in move&view about potential change - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->updateClickActionViews(); - } - } - - updateTable(); - break; - case 2: // Cancel - default: - //exit; - break; - } -} - -// Bypass to let Move & view read values without need to create own key binding handler -// Assumes third person view -// Might be better idea to just move whole mConflictHandler into LLFloaterPreference -bool LLPanelPreferenceControls::canKeyBindHandle(const std::string &control, EMouseClickType click, KEY key, MASK mask) -{ - S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON; - if (mConflictHandler[mode].empty()) - { - // opening for first time - mConflictHandler[mode].loadFromSettings(LLKeyConflictHandler::MODE_THIRD_PERSON); - } - - return mConflictHandler[mode].canHandleControl(control, click, key, mask); -} - -// Bypass to let Move & view modify values without need to create own key binding handler -// Assumes third person view -// Might be better idea to just move whole mConflictHandler into LLFloaterPreference -void LLPanelPreferenceControls::setKeyBind(const std::string &control, EMouseClickType click, KEY key, MASK mask, bool set) -{ - S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON; - if (mConflictHandler[mode].empty()) - { - // opening for first time - mConflictHandler[mode].loadFromSettings(LLKeyConflictHandler::MODE_THIRD_PERSON); - } - - if (!mConflictHandler[mode].canAssignControl(mEditingControl)) - { - return; - } - - bool already_recorded = mConflictHandler[mode].canHandleControl(control, click, key, mask); - if (set) - { - if (already_recorded) - { - // nothing to do - return; - } - - // find free spot to add data, if no free spot, assign to first - S32 index = 0; - for (S32 i = 0; i < 3; i++) - { - if (mConflictHandler[mode].getControl(control, i).isEmpty()) - { - index = i; - break; - } - } - mConflictHandler[mode].registerControl(control, index, click, key, mask, true); - } - else if (!set) - { - if (!already_recorded) - { - // nothing to do - return; - } - - // find specific control and reset it - for (S32 i = 0; i < 3; i++) - { - LLKeyData data = mConflictHandler[mode].getControl(control, i); - if (data.mMouse == click && data.mKey == key && data.mMask == mask) - { - mConflictHandler[mode].clearControl(control, i); - } - } - } -} - -void LLPanelPreferenceControls::updateAndApply() -{ - S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON; - mConflictHandler[mode].saveToSettings(true); - updateTable(); -} - -// from LLSetKeybindDialog's interface -bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes) -{ - if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) - { - return true; - } - - if ( mEditingColumn > 0) - { - if (all_modes) - { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - if (mConflictHandler[i].empty()) - { - mConflictHandler[i].loadFromSettings((LLKeyConflictHandler::ESourceMode)i); - } - mConflictHandler[i].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true); - // Apply changes to viewer as 'temporary' - mConflictHandler[i].saveToSettings(true); - } - } - else - { - mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true); - // Apply changes to viewer as 'temporary' - mConflictHandler[mEditingMode].saveToSettings(true); - } - } - - updateTable(); - - if ((mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON || all_modes) - && (mEditingControl == "walk_to" - || mEditingControl == "teleport_to" - || click == CLICK_LEFT - || click == CLICK_DOUBLELEFT)) - { - // notify comboboxes in move&view about potential change - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->updateClickActionViews(); - } - } - - return true; -} - -void LLPanelPreferenceControls::onDefaultKeyBind(bool all_modes) -{ - if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl)) - { - return; - } - - if (mEditingColumn > 0) - { - if (all_modes) - { - for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i) - { - if (mConflictHandler[i].empty()) - { - mConflictHandler[i].loadFromSettings((LLKeyConflictHandler::ESourceMode)i); - } - mConflictHandler[i].resetToDefault(mEditingControl, mEditingColumn - 1); - // Apply changes to viewer as 'temporary' - mConflictHandler[i].saveToSettings(true); - } - } - else - { - mConflictHandler[mEditingMode].resetToDefault(mEditingControl, mEditingColumn - 1); - // Apply changes to viewer as 'temporary' - mConflictHandler[mEditingMode].saveToSettings(true); - } - } - updateTable(); - - if (mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON || all_modes) - { - // notify comboboxes in move&view about potential change - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->updateClickActionViews(); - } - } -} - -void LLPanelPreferenceControls::onCancelKeyBind() -{ - pControlsTable->deselectAllItems(); -} - LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key) : LLFloater(key) { -- cgit v1.2.3