Expose separate middle and right mouse scroll config.
This commit is contained in:
@@ -170,7 +170,8 @@ namespace OpenRA
|
|||||||
|
|
||||||
public bool ViewportEdgeScroll = true;
|
public bool ViewportEdgeScroll = true;
|
||||||
public bool LockMouseWindow = false;
|
public bool LockMouseWindow = false;
|
||||||
public MouseScrollType MouseScroll = MouseScrollType.Standard;
|
public MouseScrollType MiddleMouseScroll = MouseScrollType.Standard;
|
||||||
|
public MouseScrollType RightMouseScroll = MouseScrollType.Disabled;
|
||||||
public MouseButtonPreference MouseButtonPreference = new MouseButtonPreference();
|
public MouseButtonPreference MouseButtonPreference = new MouseButtonPreference();
|
||||||
public float ViewportEdgeScrollStep = 10f;
|
public float ViewportEdgeScrollStep = 10f;
|
||||||
public float UIScrollSpeed = 50f;
|
public float UIScrollSpeed = 50f;
|
||||||
|
|||||||
@@ -402,9 +402,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
MakeMouseFocusSettingsLive();
|
MakeMouseFocusSettingsLive();
|
||||||
};
|
};
|
||||||
|
|
||||||
var mouseScrollDropdown = panel.Get<DropDownButtonWidget>("MOUSE_SCROLL");
|
var middleMouseScrollDropdown = panel.Get<DropDownButtonWidget>("MIDDLE_MOUSE_SCROLL");
|
||||||
mouseScrollDropdown.OnMouseDown = _ => ShowMouseScrollDropdown(mouseScrollDropdown, gs);
|
middleMouseScrollDropdown.OnMouseDown = _ => ShowMouseScrollDropdown(middleMouseScrollDropdown, gs, false);
|
||||||
mouseScrollDropdown.GetText = () => gs.MouseScroll.ToString();
|
middleMouseScrollDropdown.GetText = () => gs.MiddleMouseScroll.ToString();
|
||||||
|
|
||||||
|
var rightMouseScrollDropdown = panel.Get<DropDownButtonWidget>("RIGHT_MOUSE_SCROLL");
|
||||||
|
rightMouseScrollDropdown.OnMouseDown = _ => ShowMouseScrollDropdown(rightMouseScrollDropdown, gs, true);
|
||||||
|
rightMouseScrollDropdown.GetText = () => gs.RightMouseScroll.ToString();
|
||||||
|
|
||||||
var zoomModifierDropdown = panel.Get<DropDownButtonWidget>("ZOOM_MODIFIER");
|
var zoomModifierDropdown = panel.Get<DropDownButtonWidget>("ZOOM_MODIFIER");
|
||||||
zoomModifierDropdown.OnMouseDown = _ => ShowZoomModifierDropdown(zoomModifierDropdown, gs);
|
zoomModifierDropdown.OnMouseDown = _ => ShowZoomModifierDropdown(zoomModifierDropdown, gs);
|
||||||
@@ -573,7 +577,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return () =>
|
return () =>
|
||||||
{
|
{
|
||||||
gs.UseClassicMouseStyle = dgs.UseClassicMouseStyle;
|
gs.UseClassicMouseStyle = dgs.UseClassicMouseStyle;
|
||||||
gs.MouseScroll = dgs.MouseScroll;
|
gs.MiddleMouseScroll = dgs.MiddleMouseScroll;
|
||||||
|
gs.RightMouseScroll = dgs.RightMouseScroll;
|
||||||
gs.LockMouseWindow = dgs.LockMouseWindow;
|
gs.LockMouseWindow = dgs.LockMouseWindow;
|
||||||
gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll;
|
gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll;
|
||||||
gs.ViewportEdgeScrollStep = dgs.ViewportEdgeScrollStep;
|
gs.ViewportEdgeScrollStep = dgs.ViewportEdgeScrollStep;
|
||||||
@@ -633,7 +638,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
static bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s, bool rightMouse)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, MouseScrollType>()
|
var options = new Dictionary<string, MouseScrollType>()
|
||||||
{
|
{
|
||||||
@@ -646,8 +651,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||||
() => s.MouseScroll == options[o],
|
() => (rightMouse ? s.RightMouseScroll : s.MiddleMouseScroll) == options[o],
|
||||||
() => s.MouseScroll = options[o]);
|
() => { if (rightMouse) s.RightMouseScroll = options[o]; else s.MiddleMouseScroll = options[o]; });
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -225,32 +225,37 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scrolltype = Game.Settings.Game.MouseScroll;
|
var scrollType = MouseScrollType.Disabled;
|
||||||
if (scrolltype == MouseScrollType.Disabled)
|
|
||||||
|
if (mi.Button == MouseButton.Middle || mi.Button == (MouseButton.Left | MouseButton.Right))
|
||||||
|
scrollType = Game.Settings.Game.MiddleMouseScroll;
|
||||||
|
else if (mi.Button == MouseButton.Right)
|
||||||
|
scrollType = Game.Settings.Game.RightMouseScroll;
|
||||||
|
|
||||||
|
if (scrollType == MouseScrollType.Disabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (scrolltype == MouseScrollType.Standard || scrolltype == MouseScrollType.Inverted)
|
if (scrollType == MouseScrollType.Standard || scrollType == MouseScrollType.Inverted)
|
||||||
{
|
{
|
||||||
if (mi.Event == MouseInputEvent.Move &&
|
if (mi.Event == MouseInputEvent.Move)
|
||||||
(mi.Button == MouseButton.Middle || mi.Button == (MouseButton.Left | MouseButton.Right)))
|
|
||||||
{
|
{
|
||||||
var d = scrolltype == MouseScrollType.Inverted ? -1 : 1;
|
var d = scrollType == MouseScrollType.Inverted ? -1 : 1;
|
||||||
worldRenderer.Viewport.Scroll((Viewport.LastMousePos - mi.Location) * d, false);
|
worldRenderer.Viewport.Scroll((Viewport.LastMousePos - mi.Location) * d, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tiberian Sun style right-click-and-drag scrolling
|
// Tiberian Sun style click-and-drag scrolling
|
||||||
if (scrolltype == MouseScrollType.Joystick)
|
if (scrollType == MouseScrollType.Joystick)
|
||||||
{
|
{
|
||||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down)
|
if (mi.Event == MouseInputEvent.Down)
|
||||||
{
|
{
|
||||||
if (!TakeMouseFocus(mi))
|
if (!TakeMouseFocus(mi))
|
||||||
return false;
|
return false;
|
||||||
joystickScrollStart = mi.Location;
|
joystickScrollStart = mi.Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Up)
|
if (mi.Event == MouseInputEvent.Up)
|
||||||
{
|
{
|
||||||
var wasJoystickScrolling = IsJoystickScrolling;
|
var wasJoystickScrolling = IsJoystickScrolling;
|
||||||
|
|
||||||
@@ -261,10 +266,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi.Event == MouseInputEvent.Move && mi.Button == MouseButton.Right && joystickScrollStart.HasValue)
|
if (mi.Event == MouseInputEvent.Move && joystickScrollStart.HasValue)
|
||||||
{
|
|
||||||
joystickScrollEnd = mi.Location;
|
joystickScrollEnd = mi.Location;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -337,84 +337,97 @@ Container@SETTINGS_PANEL:
|
|||||||
Width: 250
|
Width: 250
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Left-Click Orders
|
Text: Left-click Orders
|
||||||
Label@MOUSE_SCROLL_LABEL:
|
Label@MIDDLE_MOUSE_SCROLL_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 120
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
Y: 39
|
Y: 39
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Mouse Scrolling Method:
|
Text: Middle-mouse Scrolling:
|
||||||
Align: Right
|
Align: Right
|
||||||
DropDownButton@MOUSE_SCROLL:
|
DropDownButton@MIDDLE_MOUSE_SCROLL:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
Y: 38
|
Y: 38
|
||||||
Width: 100
|
Width: 100
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Enabled
|
Label@MIDDLE_MOUSE_SCROLL_LABEL:
|
||||||
Checkbox@ALLOW_ZOOM_CHECKBOX:
|
|
||||||
X: 15
|
|
||||||
Y: 70
|
|
||||||
Width: 130
|
|
||||||
Height: 20
|
|
||||||
Font: Regular
|
|
||||||
Text: Allow zoom
|
|
||||||
Label@ZOOM_MODIFIER_LABEL:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 120
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
Y: 68
|
Y: 69
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Modifier used to zoom:
|
Text: Right-mouse Scrolling:
|
||||||
|
Align: Right
|
||||||
|
DropDownButton@RIGHT_MOUSE_SCROLL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
|
Y: 68
|
||||||
|
Width: 100
|
||||||
|
Height: 25
|
||||||
|
Font: Regular
|
||||||
|
Label@ZOOM_MODIFIER_LABEL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
|
Y: 98
|
||||||
|
Width: 160
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Scroll-zoom Modifier:
|
||||||
Align: Right
|
Align: Right
|
||||||
DropDownButton@ZOOM_MODIFIER:
|
DropDownButton@ZOOM_MODIFIER:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
Y: 68
|
Y: 98
|
||||||
Width: 100
|
Width: 100
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Alt
|
Text: Alt
|
||||||
Checkbox@EDGESCROLL_CHECKBOX:
|
Checkbox@EDGESCROLL_CHECKBOX:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 100
|
Y: 70
|
||||||
Width: 130
|
Width: 130
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Edge Scrolling
|
Text: Edge Scrolling
|
||||||
|
Checkbox@ALLOW_ZOOM_CHECKBOX:
|
||||||
|
X: 15
|
||||||
|
Y: 100
|
||||||
|
Width: 130
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Scroll Zooming
|
||||||
Checkbox@LOCKMOUSE_CHECKBOX:
|
Checkbox@LOCKMOUSE_CHECKBOX:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 130
|
Y: 130
|
||||||
Width: 130
|
Width: 130
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Lock mouse to window
|
Text: Lock Mouse to Window
|
||||||
Label@SCROLL_SPEED_LABEL:
|
Label@SCROLL_SPEED_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
X: PARENT_RIGHT - WIDTH - 270
|
||||||
Y: 97
|
Y: 127
|
||||||
Width: 95
|
Width: 95
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: Scroll Speed:
|
Text: Scroll Speed:
|
||||||
Align: Right
|
Align: Right
|
||||||
Slider@SCROLLSPEED_SLIDER:
|
Slider@SCROLLSPEED_SLIDER:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 170
|
||||||
Y: 103
|
Y: 133
|
||||||
Width: 250
|
Width: 100
|
||||||
Height: 20
|
Height: 20
|
||||||
Ticks: 5
|
Ticks: 5
|
||||||
MinimumValue: 10
|
MinimumValue: 10
|
||||||
MaximumValue: 50
|
MaximumValue: 50
|
||||||
Label@UI_SCROLL_SPEED_LABEL:
|
Label@UI_SCROLL_SPEED_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
X: PARENT_RIGHT - WIDTH - 106
|
||||||
Y: 127
|
Y: 127
|
||||||
Width: 95
|
Width: 95
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: UI Scroll Speed:
|
Text: UI Scroll:
|
||||||
Align: Right
|
Align: Right
|
||||||
Slider@UI_SCROLLSPEED_SLIDER:
|
Slider@UI_SCROLLSPEED_SLIDER:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 6
|
||||||
Y: 133
|
Y: 133
|
||||||
Width: 250
|
Width: 100
|
||||||
Height: 20
|
Height: 20
|
||||||
Ticks: 5
|
Ticks: 5
|
||||||
MinimumValue: 1
|
MinimumValue: 1
|
||||||
|
|||||||
@@ -341,51 +341,64 @@ Background@SETTINGS_PANEL:
|
|||||||
Width: 250
|
Width: 250
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Left-Click Orders
|
Text: Left-click Orders
|
||||||
Label@MOUSE_SCROLL_LABEL:
|
Label@MIDDLE_MOUSE_SCROLL_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 120
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
Y: 39
|
Y: 39
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Mouse Scrolling Method:
|
Text: Middle-mouse Scrolling:
|
||||||
Align: Right
|
Align: Right
|
||||||
DropDownButton@MOUSE_SCROLL:
|
DropDownButton@MIDDLE_MOUSE_SCROLL:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
Y: 38
|
Y: 38
|
||||||
Width: 100
|
Width: 100
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Enabled
|
Label@MIDDLE_MOUSE_SCROLL_LABEL:
|
||||||
Checkbox@ALLOW_ZOOM_CHECKBOX:
|
|
||||||
X: 15
|
|
||||||
Y: 70
|
|
||||||
Width: 130
|
|
||||||
Height: 20
|
|
||||||
Font: Regular
|
|
||||||
Text: Allow zoom
|
|
||||||
Label@ZOOM_MODIFIER_LABEL:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 120
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
Y: 68
|
Y: 69
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Modifier used to zoom:
|
Text: Right-mouse Scrolling:
|
||||||
|
Align: Right
|
||||||
|
DropDownButton@RIGHT_MOUSE_SCROLL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
|
Y: 68
|
||||||
|
Width: 100
|
||||||
|
Height: 25
|
||||||
|
Font: Regular
|
||||||
|
Label@ZOOM_MODIFIER_LABEL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
|
Y: 98
|
||||||
|
Width: 160
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Scroll-zoom Modifier:
|
||||||
Align: Right
|
Align: Right
|
||||||
DropDownButton@ZOOM_MODIFIER:
|
DropDownButton@ZOOM_MODIFIER:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
Y: 68
|
Y: 98
|
||||||
Width: 100
|
Width: 100
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Alt
|
Text: Alt
|
||||||
Checkbox@EDGESCROLL_CHECKBOX:
|
Checkbox@EDGESCROLL_CHECKBOX:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 100
|
Y: 70
|
||||||
Width: 130
|
Width: 130
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Edge Scrolling
|
Text: Edge Scrolling
|
||||||
|
Checkbox@ALLOW_ZOOM_CHECKBOX:
|
||||||
|
X: 15
|
||||||
|
Y: 100
|
||||||
|
Width: 130
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Scroll Zooming
|
||||||
Checkbox@LOCKMOUSE_CHECKBOX:
|
Checkbox@LOCKMOUSE_CHECKBOX:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 130
|
Y: 130
|
||||||
@@ -395,30 +408,30 @@ Background@SETTINGS_PANEL:
|
|||||||
Text: Lock mouse to window
|
Text: Lock mouse to window
|
||||||
Label@SCROLL_SPEED_LABEL:
|
Label@SCROLL_SPEED_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
X: PARENT_RIGHT - WIDTH - 270
|
||||||
Y: 97
|
Y: 127
|
||||||
Width: 95
|
Width: 95
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: Scroll Speed:
|
Text: Scroll Speed:
|
||||||
Align: Right
|
Align: Right
|
||||||
Slider@SCROLLSPEED_SLIDER:
|
Slider@SCROLLSPEED_SLIDER:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 170
|
||||||
Y: 103
|
Y: 133
|
||||||
Width: 250
|
Width: 100
|
||||||
Height: 20
|
Height: 20
|
||||||
Ticks: 5
|
Ticks: 5
|
||||||
MinimumValue: 10
|
MinimumValue: 10
|
||||||
MaximumValue: 50
|
MaximumValue: 50
|
||||||
Label@UI_SCROLL_SPEED_LABEL:
|
Label@UI_SCROLL_SPEED_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
X: PARENT_RIGHT - WIDTH - 106
|
||||||
Y: 127
|
Y: 127
|
||||||
Width: 95
|
Width: 95
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: UI Scroll Speed:
|
Text: UI Scroll:
|
||||||
Align: Right
|
Align: Right
|
||||||
Slider@UI_SCROLLSPEED_SLIDER:
|
Slider@UI_SCROLLSPEED_SLIDER:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 6
|
||||||
Y: 133
|
Y: 133
|
||||||
Width: 250
|
Width: 100
|
||||||
Height: 20
|
Height: 20
|
||||||
Ticks: 5
|
Ticks: 5
|
||||||
MinimumValue: 1
|
MinimumValue: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user