summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterpreference.cpp131
-rw-r--r--indra/newview/llfloaterpreference.h3
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_controls.xml10
3 files changed, 51 insertions, 93 deletions
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<LLTextBase>("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<LLSetKeyBindDialog>("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<LLScrollListItem*> 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<LLSetKeyBindDialog>("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)
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 2fe3b98abd..9100a91356 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -302,7 +302,6 @@ public:
~LLPanelPreferenceControls();
BOOL postBuild();
- BOOL handleHover(S32 x, S32 y, MASK mask);
void apply();
void cancel();
@@ -325,12 +324,10 @@ private:
LLScrollListCtrl* pControlsTable;
LLComboBox *pKeyModeBox;
- LLScrollListCell *mHighlightedCell;
LLKeyConflictHandler mConflictHandler[LLKeyConflictHandler::MODE_COUNT];
std::string mEditingControl;
S32 mEditingColumn;
S32 mEditingMode;
- bool mShowKeyDialog;
};
class LLFloaterPreferenceGraphicsAdvanced : public LLFloater
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_controls.xml b/indra/newview/skins/default/xui/en/panel_preferences_controls.xml
index 385d4796a0..b7b5280825 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_controls.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_controls.xml
@@ -256,14 +256,14 @@
width="110"
name="key_mode">
<combo_box.item
- label="First Person "
- name="first_person"
- value="0"/>
- <combo_box.item
label="Third Person "
name="third_person"
value="1"/>
<combo_box.item
+ label="First Person "
+ name="first_person"
+ value="0"/>
+ <combo_box.item
label="Edit"
name="edit"
value="2"/>
@@ -292,13 +292,13 @@
follows="all"
layout="topleft"
column_padding="0"
+ selection_type="header"
top="31"
left="3"
bottom="-3"
right="-3"
can_sort="false"
multi_select="false"
- bg_selected_color="Transparent"
name="controls_list">
<scroll_list.columns
relative_width="0.34"