summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp22
-rw-r--r--indra/newview/llfloaterpreference.cpp79
-rw-r--r--indra/newview/llkeyconflict.cpp28
-rw-r--r--indra/newview/llkeyconflict.h1
-rw-r--r--indra/newview/skins/default/xui/en/control_table_contents_camera.xml62
-rw-r--r--indra/newview/skins/default/xui/en/control_table_contents_camera_sitting.xml65
6 files changed, 161 insertions, 96 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index adbd81aae3..e20c9e663c 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1021,6 +1021,7 @@ bool LLAppViewer::init()
LL_INFOS("InitInfo") << "Converting legacy mouse bindings to new format" << LL_ENDL;
// Load settings from file
LLKeyConflictHandler third_person_view(LLKeyConflictHandler::MODE_THIRD_PERSON);
+ LLKeyConflictHandler sitting_view(LLKeyConflictHandler::MODE_SITTING);
// Since we are only modifying keybindings if personal file doesn't exist yet,
// it should be safe to just overwrite the value
@@ -1050,6 +1051,14 @@ bool LLAppViewer::init()
MASK_NONE,
value);
+ // sitting also supports teleport
+ sitting_view.registerControl("teleport_to",
+ 0,
+ value ? EMouseClickType::CLICK_DOUBLELEFT : EMouseClickType::CLICK_NONE,
+ KEY_NONE,
+ MASK_NONE,
+ value);
+
std::string key_string = gSavedSettings.getString("PushToTalkButton");
EMouseClickType mouse = EMouseClickType::CLICK_NONE;
KEY key = KEY_NONE;
@@ -1073,6 +1082,7 @@ bool LLAppViewer::init()
value = gSavedSettings.getBOOL("PushToTalkToggle");
std::string control_name = value ? "toggle_voice" : "voice_follow_key";
third_person_view.registerControl(control_name, 0, mouse, key, MASK_NONE, true);
+ sitting_view.registerControl(control_name, 0, mouse, key, MASK_NONE, true);
if (third_person_view.hasUnsavedChanges())
{
@@ -1080,12 +1090,18 @@ bool LLAppViewer::init()
third_person_view.saveToSettings();
}
- // in case of voice we need to repeat this in other modes (teleports and
- // autopilot are not entirely practical when sitting or editing)
+ if (sitting_view.hasUnsavedChanges())
+ {
+ // calls loadBindingsXML()
+ sitting_view.saveToSettings();
+ }
+
+ // in case of voice we need to repeat this in other modes
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
- if (i != LLKeyConflictHandler::MODE_THIRD_PERSON)
+ // edit and first person modes; MODE_SAVED_SETTINGS not in use at the moment
+ if (i != LLKeyConflictHandler::MODE_THIRD_PERSON && i != LLKeyConflictHandler::MODE_SITTING)
{
LLKeyConflictHandler handler((LLKeyConflictHandler::ESourceMode)i);
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index b8edf4ad84..f4a19d06b0 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -2801,20 +2801,34 @@ bool LLPanelPreferenceControls::addControlTableRows(const std::string &filename)
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 show = true;
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);
+ if (!enabled)
+ {
+ // If empty: this is a placeholder to make sure user won't assign
+ // value by accident, don't show it
+ // If not empty: predefined control combination user should see
+ // to know that combination is reserved
+ show = !mConflictHandler[mEditingMode].isControlEmpty(control);
+ // example: teleport_to and walk_to in first person view, and
+ // sitting related functions, see generatePlaceholders()
+ }
+
+ if (show)
+ {
+ // At the moment viewer is hardcoded to assume that columns are named as lst_ctrl%d
+ LLScrollListItem::Params item_params(*row_it);
+ item_params.enabled.setValue(enabled);
+
+ S32 num_columns = pControlsTable->getNumColumns();
+ for (S32 col = 1; col < num_columns; col++)
+ {
+ cell_params.column = llformat("lst_ctrl%d", col);
+ cell_params.value = mConflictHandler[mEditingMode].getControlString(control, col - 1);
+ item_params.columns.add(cell_params);
+ }
+ pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM);
+ }
}
else
{
@@ -2825,7 +2839,8 @@ bool LLPanelPreferenceControls::addControlTableRows(const std::string &filename)
// type = "icon"
// color = "0 0 0 0.7"
// halign = "center"
- // value = "menu_separator" />
+ // value = "menu_separator"
+ // column = "lst_action" / >
//</rows>
pControlsTable->addRow(*row_it, EAddPosition::ADD_BOTTOM);
}
@@ -2835,7 +2850,16 @@ bool LLPanelPreferenceControls::addControlTableRows(const std::string &filename)
void LLPanelPreferenceControls::addControlTableSeparator()
{
- pControlsTable->addSeparator(EAddPosition::ADD_BOTTOM);
+ LLScrollListItem::Params separator_params;
+ separator_params.enabled(false);
+ LLScrollListCell::Params column_params;
+ column_params.type = "icon";
+ column_params.value = "menu_separator";
+ column_params.column = "lst_action";
+ column_params.color = LLColor4(0.f, 0.f, 0.f, 0.7f);
+ column_params.font_halign = LLFontGL::HCENTER;
+ separator_params.columns.add(column_params);
+ pControlsTable->addRow(separator_params, EAddPosition::ADD_BOTTOM);
}
void LLPanelPreferenceControls::populateControlTable()
@@ -2843,7 +2867,7 @@ void LLPanelPreferenceControls::populateControlTable()
pControlsTable->clearRows();
pControlsTable->clearColumns();
- // add columns
+ // Add columns
std::string filename;
switch ((LLKeyConflictHandler::ESourceMode)mEditingMode)
{
@@ -2861,9 +2885,11 @@ void LLPanelPreferenceControls::populateControlTable()
}
addControlTableColumns(filename);
-
+ // Add rows.
+ // Each file represents individual visual group (movement/camera/media...)
if (mEditingMode == LLKeyConflictHandler::MODE_FIRST_PERSON)
{
+ // Don't display whole camera and editing groups
addControlTableRows("control_table_contents_movement.xml");
addControlTableSeparator();
addControlTableRows("control_table_contents_media.xml");
@@ -2872,14 +2898,11 @@ void LLPanelPreferenceControls::populateControlTable()
else if (mEditingMode < LLKeyConflictHandler::MODE_SAVED_SETTINGS)
{
// In case of 'sitting' mode, movements still apply due to vehicles
+ // but walk_to is not supported and will be hidden by addControlTableRows
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");
@@ -2903,12 +2926,14 @@ void LLPanelPreferenceControls::updateTable()
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));
+ LLScrollListCell* cell = NULL;
+
+ S32 num_columns = pControlsTable->getNumColumns();
+ for (S32 col = 1; col < num_columns; col++)
+ {
+ cell = list[i]->getColumn(col);
+ cell->setValue(mConflictHandler[mEditingMode].getControlString(control, col - 1));
+ }
}
}
pControlsTable->deselectAllItems();
diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp
index 8ee50d5c52..b6107eeedf 100644
--- a/indra/newview/llkeyconflict.cpp
+++ b/indra/newview/llkeyconflict.cpp
@@ -243,6 +243,15 @@ LLKeyData LLKeyConflictHandler::getControl(const std::string &control_name, U32
return mControlsMap[control_name].getKeyData(index);
}
+bool LLKeyConflictHandler::isControlEmpty(const std::string &control_name)
+{
+ if (control_name.empty())
+ {
+ return true;
+ }
+ return mControlsMap[control_name].mKeyBind.isEmpty();
+}
+
// static
std::string LLKeyConflictHandler::getStringFromKeyData(const LLKeyData& keydata)
{
@@ -885,10 +894,27 @@ void LLKeyConflictHandler::generatePlaceholders(ESourceMode load_mode)
registerTemporaryControl("edit_avatar_spin_under");
registerTemporaryControl("edit_avatar_move_forward");
registerTemporaryControl("edit_avatar_move_backward");
+
+ // no autopilot or teleport
+ registerTemporaryControl("walk_to");
+ registerTemporaryControl("teleport_to");
+ }
+
+ if (load_mode == MODE_EDIT_AVATAR)
+ {
+ // no autopilot or teleport
+ registerTemporaryControl("walk_to");
+ registerTemporaryControl("teleport_to");
}
- if (load_mode != MODE_SITTING)
+ if (load_mode == MODE_SITTING)
+ {
+ // no autopilot
+ registerTemporaryControl("walk_to");
+ }
+ else
{
+ // sitting related functions should only be avaliable in sitting mode
registerTemporaryControl("move_forward_sitting");
registerTemporaryControl("move_backward_sitting");
registerTemporaryControl("spin_over_sitting");
diff --git a/indra/newview/llkeyconflict.h b/indra/newview/llkeyconflict.h
index 7566303cdd..2926ca3aeb 100644
--- a/indra/newview/llkeyconflict.h
+++ b/indra/newview/llkeyconflict.h
@@ -98,6 +98,7 @@ public:
bool clearControl(const std::string &control_name, U32 data_index);
LLKeyData getControl(const std::string &control_name, U32 data_index);
+ bool isControlEmpty(const std::string &control_name);
// localized string
static std::string getStringFromKeyData(const LLKeyData& keydata);
diff --git a/indra/newview/skins/default/xui/en/control_table_contents_camera.xml b/indra/newview/skins/default/xui/en/control_table_contents_camera.xml
index aba81e3134..24cbb2b885 100644
--- a/indra/newview/skins/default/xui/en/control_table_contents_camera.xml
+++ b/indra/newview/skins/default/xui/en/control_table_contents_camera.xml
@@ -175,4 +175,66 @@
tool_tip="Camera spin around clockwise"
value="Clockwise" />
</rows>
+ <rows
+ name="move_forward_sitting"
+ value="move_forward_sitting">
+ <columns
+ column="lst_action"
+ font="SansSerif"
+ halign="left"
+ name="lst_action"
+ value="Camera Forward Sitting" />
+ </rows>
+ <rows
+ name="move_backward_sitting"
+ value="move_backward_sitting">
+ <columns
+ column="lst_action"
+ font="SansSerif"
+ halign="left"
+ name="lst_action"
+ value="Camera Backward Sitting" />
+ </rows>
+ <rows
+ name="spin_over_sitting"
+ value="spin_over_sitting">
+ <columns
+ column="lst_action"
+ font="SansSerif"
+ halign="left"
+ name="lst_action"
+ value="Camera Spin Over Sitting" />
+ </rows>
+ <rows
+ name="spin_under_sitting"
+ value="spin_under_sitting">
+ <columns
+ column="lst_action"
+ font="SansSerif"
+ halign="left"
+ name="lst_action"
+ value="Camera Spin Under Sitting" />
+ </rows>
+ <rows
+ name="spin_around_ccw_sitting"
+ value="spin_around_ccw_sitting">
+ <columns
+ column="lst_action"
+ font="SansSerif"
+ halign="left"
+ name="lst_action"
+ tool_tip="Camera spin around counterclockwise sitting"
+ value="Counterclockwise Sitting" />
+ </rows>
+ <rows
+ name="spin_around_cw_sitting"
+ value="spin_around_cw_sitting">
+ <columns
+ column="lst_action"
+ font="SansSerif"
+ halign="left"
+ name="lst_action"
+ tool_tip="Camera spin around clockwise sitting"
+ value="Clockwise Sitting" />
+ </rows>
</contents>
diff --git a/indra/newview/skins/default/xui/en/control_table_contents_camera_sitting.xml b/indra/newview/skins/default/xui/en/control_table_contents_camera_sitting.xml
deleted file mode 100644
index 9334c6e179..0000000000
--- a/indra/newview/skins/default/xui/en/control_table_contents_camera_sitting.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<contents>
- <rows
- name="move_forward_sitting"
- value="move_forward_sitting">
- <columns
- column="lst_action"
- font="SansSerif"
- halign="left"
- name="lst_action"
- value="Camera Forward Sitting" />
- </rows>
- <rows
- name="move_backward_sitting"
- value="move_backward_sitting">
- <columns
- column="lst_action"
- font="SansSerif"
- halign="left"
- name="lst_action"
- value="Camera Backward Sitting" />
- </rows>
- <rows
- name="spin_over_sitting"
- value="spin_over_sitting">
- <columns
- column="lst_action"
- font="SansSerif"
- halign="left"
- name="lst_action"
- value="Camera Spin Over Sitting" />
- </rows>
- <rows
- name="spin_under_sitting"
- value="spin_under_sitting">
- <columns
- column="lst_action"
- font="SansSerif"
- halign="left"
- name="lst_action"
- value="Camera Spin Under Sitting" />
- </rows>
- <rows
- name="spin_around_ccw_sitting"
- value="spin_around_ccw_sitting">
- <columns
- column="lst_action"
- font="SansSerif"
- halign="left"
- name="lst_action"
- tool_tip="Camera spin around counterclockwise sitting"
- value="Counterclockwise Sitting" />
- </rows>
- <rows
- name="spin_around_cw_sitting"
- value="spin_around_cw_sitting">
- <columns
- column="lst_action"
- font="SansSerif"
- halign="left"
- name="lst_action"
- tool_tip="Camera spin around clockwise sitting"
- value="Clockwise Sitting" />
- </rows>
-</contents>