From 526111923cc379944a65f88174907ea16e447444 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Thu, 20 Feb 2020 01:19:59 -0800 Subject: [PATCH 1/5] Refactor Controls to default to MouseFilterMode.Ignore --- Content.Client/Chat/ChatBox.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index 3ad087d1ae..87bbebba1b 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -43,6 +43,7 @@ namespace Content.Client.Chat AnchorLeft = 1.0f; AnchorRight = 1.0f;*/ + MouseFilter = MouseFilterMode.Stop; var outerVBox = new VBoxContainer(); From 4bdb45731adbf930189a3a6369e37ddd36bf5aea Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Thu, 20 Feb 2020 01:21:23 -0800 Subject: [PATCH 2/5] Clean up MouseFilterMode.Ignore from Controls --- Content.Client/Chat/ChatManager.cs | 7 ++----- Content.Client/Chat/SpeechBubble.cs | 5 +---- .../Components/Storage/ClientStorageComponent.cs | 7 +++---- Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs | 7 +------ Content.Client/UserInterface/CharacterSetupGui.cs | 2 -- Content.Client/UserInterface/GameHud.cs | 7 +------ Content.Client/UserInterface/HandsGui.cs | 6 +----- Content.Client/UserInterface/ItemSlotButton.cs | 2 -- Content.Client/UserInterface/StatusEffectsUI.cs | 3 +-- 9 files changed, 10 insertions(+), 36 deletions(-) diff --git a/Content.Client/Chat/ChatManager.cs b/Content.Client/Chat/ChatManager.cs index e0ee549fbd..a2a3e04ae7 100644 --- a/Content.Client/Chat/ChatManager.cs +++ b/Content.Client/Chat/ChatManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Client.Interfaces.Chat; using Content.Shared.Chat; using Robust.Client.Console; @@ -81,10 +81,7 @@ namespace Content.Client.Chat { _netManager.RegisterNetMessage(MsgChatMessage.NAME, _onChatMessage); - _speechBubbleRoot = new LayoutContainer - { - MouseFilter = Control.MouseFilterMode.Ignore - }; + _speechBubbleRoot = new LayoutContainer(); LayoutContainer.SetAnchorPreset(_speechBubbleRoot, LayoutContainer.LayoutPreset.Wide); _userInterfaceManager.StateRoot.AddChild(_speechBubbleRoot); _speechBubbleRoot.SetPositionFirst(); diff --git a/Content.Client/Chat/SpeechBubble.cs b/Content.Client/Chat/SpeechBubble.cs index 01453c12f0..2766ab1b0b 100644 --- a/Content.Client/Chat/SpeechBubble.cs +++ b/Content.Client/Chat/SpeechBubble.cs @@ -1,4 +1,4 @@ -using Content.Client.Interfaces.Chat; +using Content.Client.Interfaces.Chat; using Robust.Client.Interfaces.Graphics.ClientEye; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; @@ -44,14 +44,12 @@ namespace Content.Client.Chat _senderEntity = senderEntity; _eyeManager = eyeManager; - MouseFilter = MouseFilterMode.Ignore; // Use text clipping so new messages don't overlap old ones being pushed up. RectClipContent = true; var label = new RichTextLabel { MaxWidth = 256, - MouseFilter = MouseFilterMode.Ignore }; label.SetMessage(text); @@ -59,7 +57,6 @@ namespace Content.Client.Chat { StyleClasses = { "tooltipBox" }, Children = { label }, - MouseFilter = MouseFilterMode.Ignore, ModulateSelfOverride = Color.White.WithAlpha(0.75f) }; diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index a1491a0a7a..f66c6c7751 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -242,23 +242,22 @@ namespace Content.Client.GameObjects.Components.Storage }; AddChild(ActualButton); - var hBoxContainer = new HBoxContainer {MouseFilter = MouseFilterMode.Ignore}; + var hBoxContainer = new HBoxContainer(); EntitySpriteView = new SpriteView { - CustomMinimumSize = new Vector2(32.0f, 32.0f), MouseFilter = MouseFilterMode.Ignore + CustomMinimumSize = new Vector2(32.0f, 32.0f) }; EntityName = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Backpack", - MouseFilter = MouseFilterMode.Ignore }; hBoxContainer.AddChild(EntitySpriteView); hBoxContainer.AddChild(EntityName); EntityControl = new Control { - SizeFlagsHorizontal = SizeFlags.FillExpand, MouseFilter = MouseFilterMode.Ignore + SizeFlagsHorizontal = SizeFlags.FillExpand }; EntitySize = new Label { diff --git a/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs b/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs index 53b350bdd0..30b8238d20 100644 --- a/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs +++ b/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs @@ -345,14 +345,12 @@ namespace Content.Client.UserInterface.Cargo var hBox = new HBoxContainer { - SizeFlagsHorizontal = SizeFlags.FillExpand, - MouseFilter = MouseFilterMode.Ignore + SizeFlagsHorizontal = SizeFlags.FillExpand }; Icon = new TextureRect { CustomMinimumSize = new Vector2(32.0f, 32.0f), - MouseFilter = MouseFilterMode.Ignore, RectClipContent = true }; hBox.AddChild(Icon); @@ -366,7 +364,6 @@ namespace Content.Client.UserInterface.Cargo var panel = new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = new Color(37, 37, 42) }, - MouseFilter = MouseFilterMode.Ignore }; PointCost = new Label { @@ -396,13 +393,11 @@ namespace Content.Client.UserInterface.Cargo var hBox = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, - MouseFilter = MouseFilterMode.Ignore }; Icon = new TextureRect { CustomMinimumSize = new Vector2(32.0f, 32.0f), - MouseFilter = MouseFilterMode.Ignore, RectClipContent = true }; hBox.AddChild(Icon); diff --git a/Content.Client/UserInterface/CharacterSetupGui.cs b/Content.Client/UserInterface/CharacterSetupGui.cs index ca738faeb3..910df07ad4 100644 --- a/Content.Client/UserInterface/CharacterSetupGui.cs +++ b/Content.Client/UserInterface/CharacterSetupGui.cs @@ -231,7 +231,6 @@ namespace Content.Client.UserInterface { Sprite = _previewDummy.GetComponent(), Scale = (2, 2), - MouseFilter = MouseFilterMode.Ignore, OverrideDirection = Direction.South }; @@ -264,7 +263,6 @@ namespace Content.Client.UserInterface var internalHBox = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, - MouseFilter = MouseFilterMode.Ignore, SeparationOverride = 0, Children = { diff --git a/Content.Client/UserInterface/GameHud.cs b/Content.Client/UserInterface/GameHud.cs index 7367a82caa..fdfd3e624c 100644 --- a/Content.Client/UserInterface/GameHud.cs +++ b/Content.Client/UserInterface/GameHud.cs @@ -107,7 +107,7 @@ namespace Content.Client.UserInterface public void Initialize() { - RootControl = new LayoutContainer {MouseFilter = Control.MouseFilterMode.Ignore}; + RootControl = new LayoutContainer(); LayoutContainer.SetAnchorPreset(RootControl, LayoutContainer.LayoutPreset.Wide); var escapeTexture = _resourceCache.GetTexture("/Textures/UserInterface/hamburger.svg.96dpi.png"); @@ -237,7 +237,6 @@ namespace Content.Client.UserInterface HandsContainer = new MarginContainer { - MouseFilter = MouseFilterMode.Ignore, SizeFlagsVertical = Control.SizeFlags.ShrinkEnd }; @@ -353,13 +352,11 @@ namespace Content.Client.UserInterface AddChild(new MarginContainer { - MouseFilter = MouseFilterMode.Ignore, MarginTopOverride = 4, Children = { new VBoxContainer { - MouseFilter = MouseFilterMode.Ignore, Children = { (_textureRect = new TextureRect @@ -367,7 +364,6 @@ namespace Content.Client.UserInterface Texture = texture, SizeFlagsHorizontal = SizeFlags.ShrinkCenter, SizeFlagsVertical = SizeFlags.Expand | SizeFlags.ShrinkCenter, - MouseFilter = MouseFilterMode.Ignore, ModulateSelfOverride = ColorNormal, CustomMinimumSize = (0, 32), Stretch = TextureRect.StretchMode.KeepCentered @@ -376,7 +372,6 @@ namespace Content.Client.UserInterface { Text = keyName, SizeFlagsHorizontal = SizeFlags.ShrinkCenter, - MouseFilter = MouseFilterMode.Ignore, ModulateSelfOverride = ColorNormal, StyleClasses = {StyleClassLabelTopButton} }) diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index 0f66d323a3..2356d7e24e 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -39,8 +39,6 @@ namespace Content.Client.UserInterface { IoCManager.InjectDependencies(this); - MouseFilter = MouseFilterMode.Ignore; - var textureHandLeft = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_l.png"); var textureHandRight = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_r.png"); var textureHandActive = _resourceCache.GetTexture("/Textures/UserInterface/Inventory/hand_active.png"); @@ -54,8 +52,7 @@ namespace Content.Client.UserInterface var hBox = new HBoxContainer { SeparationOverride = 0, - Children = {_rightStatusPanel, _rightButton, _leftButton, _leftStatusPanel}, - MouseFilter = MouseFilterMode.Ignore + Children = {_rightStatusPanel, _rightButton, _leftButton, _leftStatusPanel} }; AddChild(hBox); @@ -68,7 +65,6 @@ namespace Content.Client.UserInterface // Active hand _leftButton.AddChild(ActiveHandRect = new TextureRect { - MouseFilter = MouseFilterMode.Ignore, Texture = textureHandActive, TextureScale = (2, 2) }); diff --git a/Content.Client/UserInterface/ItemSlotButton.cs b/Content.Client/UserInterface/ItemSlotButton.cs index a6b0e0fa49..f27583f737 100644 --- a/Content.Client/UserInterface/ItemSlotButton.cs +++ b/Content.Client/UserInterface/ItemSlotButton.cs @@ -31,7 +31,6 @@ namespace Content.Client.GameObjects AddChild(SpriteView = new SpriteView { - MouseFilter = MouseFilterMode.Ignore, Scale = (2, 2), OverrideDirection = Direction.South }); @@ -52,7 +51,6 @@ namespace Content.Client.GameObjects { SizeFlagsHorizontal = SizeFlags.ShrinkCenter, SizeFlagsVertical = SizeFlags.ShrinkCenter, - MouseFilter = MouseFilterMode.Ignore, Stretch = TextureRect.StretchMode.KeepCentered, TextureScale = (2, 2), Visible = false, diff --git a/Content.Client/UserInterface/StatusEffectsUI.cs b/Content.Client/UserInterface/StatusEffectsUI.cs index 2e09c01a2f..e6f0fc044f 100644 --- a/Content.Client/UserInterface/StatusEffectsUI.cs +++ b/Content.Client/UserInterface/StatusEffectsUI.cs @@ -1,4 +1,4 @@ -using Robust.Client.UserInterface; +using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; namespace Content.Client.UserInterface @@ -14,7 +14,6 @@ namespace Content.Client.UserInterface public StatusEffectsUI() { _vBox = new VBoxContainer(); - MouseFilter = Control.MouseFilterMode.Ignore; AddChild(_vBox); LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.Begin); From 14f6cbb84525882b87b4cba2297eb222fa225e6b Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Tue, 25 Feb 2020 16:52:18 -0800 Subject: [PATCH 3/5] Refactor ContainerButtons to use a StyleClass for formatting instead of typeof --- Content.Client/UserInterface/NanoStyle.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Content.Client/UserInterface/NanoStyle.cs b/Content.Client/UserInterface/NanoStyle.cs index bd5bd73a60..97cdd91310 100644 --- a/Content.Client/UserInterface/NanoStyle.cs +++ b/Content.Client/UserInterface/NanoStyle.cs @@ -307,19 +307,19 @@ namespace Content.Client.UserInterface }), // Regular buttons! - new StyleRule(new SelectorElement(typeof(Button), null, null, new[] {ContainerButton.StylePseudoClassNormal}), new[] + new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassNormal}), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonNormal), }), - new StyleRule(new SelectorElement(typeof(Button), null, null, new[] {ContainerButton.StylePseudoClassHover}), new[] + new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassHover}), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonHover), }), - new StyleRule(new SelectorElement(typeof(Button), null, null, new[] {ContainerButton.StylePseudoClassPressed}), new[] + new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassPressed}), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonPressed), }), - new StyleRule(new SelectorElement(typeof(Button), null, null, new[] {ContainerButton.StylePseudoClassDisabled}), new[] + new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassDisabled}), new[] { new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonDisabled), }), From 3edfdb8763ba2b5a00daf6d43142d41960060b33 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Tue, 25 Feb 2020 17:03:46 -0800 Subject: [PATCH 4/5] Refactor CharacterSetupButton into a ContainerButton --- .../UserInterface/CharacterSetupGui.cs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Content.Client/UserInterface/CharacterSetupGui.cs b/Content.Client/UserInterface/CharacterSetupGui.cs index 910df07ad4..3f4291deeb 100644 --- a/Content.Client/UserInterface/CharacterSetupGui.cs +++ b/Content.Client/UserInterface/CharacterSetupGui.cs @@ -141,6 +141,7 @@ namespace Content.Client.UserInterface { preferencesManager.CreateCharacter(HumanoidCharacterProfile.Default()); UpdateUI(); + args.Event.Handle(); }; hBox.AddChild(new PanelContainer @@ -179,13 +180,14 @@ namespace Content.Client.UserInterface _charactersVBox.AddChild(characterPickerButton); var characterIndexCopy = characterIndex; - characterPickerButton.ActualButton.OnPressed += args => + characterPickerButton.OnPressed += args => { _humanoidProfileEditor.Profile = (HumanoidCharacterProfile) character; _humanoidProfileEditor.CharacterSlot = characterIndexCopy; _humanoidProfileEditor.UpdateControls(); _preferencesManager.SelectCharacter(character); UpdateUI(); + args.Event.Handle(); }; characterIndex++; } @@ -195,9 +197,8 @@ namespace Content.Client.UserInterface _charactersVBox.AddChild(_createNewCharacterButton); } - private class CharacterPickerButton : Control + private class CharacterPickerButton : ContainerButton { - public readonly Button ActualButton; private IEntity _previewDummy; public CharacterPickerButton( @@ -206,6 +207,10 @@ namespace Content.Client.UserInterface ButtonGroup group, ICharacterProfile profile) { + AddStyleClass(StyleClassButton); + ToggleMode = true; + Group = group; + _previewDummy = entityManager.SpawnEntity("HumanMob_Dummy", MapCoordinates.Nullspace); _previewDummy.GetComponent().UpdateFromProfile(profile); var humanoid = profile as HumanoidCharacterProfile; @@ -216,16 +221,8 @@ namespace Content.Client.UserInterface var isSelectedCharacter = profile == preferencesManager.Preferences.SelectedCharacter; - ActualButton = new Button - { - SizeFlagsHorizontal = SizeFlags.FillExpand, - SizeFlagsVertical = SizeFlags.FillExpand, - ToggleMode = true, - Group = group - }; if (isSelectedCharacter) - ActualButton.Pressed = true; - AddChild(ActualButton); + Pressed = true; var view = new SpriteView { From 8174fdd54b88bc74c40cd7e48f4995304b8b0dfb Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Tue, 10 Mar 2020 19:42:55 -0700 Subject: [PATCH 5/5] Update submodule --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 0a306514a2..e0cdfeec54 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 0a306514a2c927d3e19f2f6fcec9eee64b488ce4 +Subproject commit e0cdfeec548c695f7eea8af48cc768b8f7ada139