diff --git a/Content.Client/Arcade/BlockGameMenu.cs b/Content.Client/Arcade/BlockGameMenu.cs index d2ae617356..c55d27e0cb 100644 --- a/Content.Client/Arcade/BlockGameMenu.cs +++ b/Content.Client/Arcade/BlockGameMenu.cs @@ -90,8 +90,8 @@ namespace Content.Client.Arcade _highscoresRootContainer = new PanelContainer { PanelOverride = rootBack, - SizeFlagsVertical = SizeFlags.ShrinkCenter, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter + VerticalAlignment = VAlignment.Center, + HorizontalAlignment = HAlignment.Center }; var c = new Color(OverlayBackgroundColor.R,OverlayBackgroundColor.G,OverlayBackgroundColor.B,220); @@ -104,20 +104,20 @@ namespace Content.Client.Arcade var menuInnerPanel = new PanelContainer { PanelOverride = innerBack, - SizeFlagsVertical = SizeFlags.ShrinkCenter, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter + VerticalAlignment = VAlignment.Center, + HorizontalAlignment = HAlignment.Center }; _highscoresRootContainer.AddChild(menuInnerPanel); var menuContainer = new VBoxContainer() { - SizeFlagsHorizontal = SizeFlags.ShrinkCenter, - SizeFlagsVertical = SizeFlags.ShrinkCenter + HorizontalAlignment = HAlignment.Center, + VerticalAlignment = VAlignment.Center }; menuContainer.AddChild(new Label{Text = Loc.GetString("Highscores")}); - menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)}); + menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); var highScoreBox = new HBoxContainer(); @@ -126,14 +126,14 @@ namespace Content.Client.Arcade Align = Label.AlignMode.Center }; highScoreBox.AddChild(_localHighscoresLabel); - highScoreBox.AddChild(new Control{CustomMinimumSize = new Vector2(40,1)}); + highScoreBox.AddChild(new Control{MinSize = new Vector2(40,1)}); _globalHighscoresLabel = new Label { Align = Label.AlignMode.Center }; highScoreBox.AddChild(_globalHighscoresLabel); menuContainer.AddChild(highScoreBox); - menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)}); + menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); _highscoreBackButton = new Button { Text = Loc.GetString("Back"), @@ -156,8 +156,8 @@ namespace Content.Client.Arcade _gameOverRootContainer = new PanelContainer { PanelOverride = rootBack, - SizeFlagsVertical = SizeFlags.ShrinkCenter, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter + VerticalAlignment = VAlignment.Center, + HorizontalAlignment = HAlignment.Center }; var innerBack = new StyleBoxTexture @@ -169,25 +169,25 @@ namespace Content.Client.Arcade var menuInnerPanel = new PanelContainer { PanelOverride = innerBack, - SizeFlagsVertical = SizeFlags.ShrinkCenter, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter + VerticalAlignment = VAlignment.Center, + HorizontalAlignment = HAlignment.Center }; _gameOverRootContainer.AddChild(menuInnerPanel); var menuContainer = new VBoxContainer { - SizeFlagsHorizontal = SizeFlags.ShrinkCenter, - SizeFlagsVertical = SizeFlags.ShrinkCenter + HorizontalAlignment = HAlignment.Center, + VerticalAlignment = VAlignment.Center }; menuContainer.AddChild(new Label{Text = Loc.GetString("Gameover!"),Align = Label.AlignMode.Center}); - menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)}); + menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); _finalScoreLabel = new Label{Align = Label.AlignMode.Center}; menuContainer.AddChild(_finalScoreLabel); - menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)}); + menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); _finalNewGameButton = new Button { @@ -214,8 +214,8 @@ namespace Content.Client.Arcade _menuRootContainer = new PanelContainer { PanelOverride = rootBack, - SizeFlagsVertical = SizeFlags.ShrinkCenter, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter + VerticalAlignment = VAlignment.Center, + HorizontalAlignment = HAlignment.Center }; var innerBack = new StyleBoxTexture @@ -227,8 +227,8 @@ namespace Content.Client.Arcade var menuInnerPanel = new PanelContainer { PanelOverride = innerBack, - SizeFlagsVertical = SizeFlags.ShrinkCenter, - SizeFlagsHorizontal = SizeFlags.ShrinkCenter + VerticalAlignment = VAlignment.Center, + HorizontalAlignment = HAlignment.Center }; _menuRootContainer.AddChild(menuInnerPanel); @@ -236,8 +236,8 @@ namespace Content.Client.Arcade var menuContainer = new VBoxContainer { - SizeFlagsHorizontal = SizeFlags.ShrinkCenter, - SizeFlagsVertical = SizeFlags.ShrinkCenter + HorizontalAlignment = HAlignment.Center, + VerticalAlignment = VAlignment.Center }; _newGameButton = new Button @@ -250,7 +250,7 @@ namespace Content.Client.Arcade _owner.SendAction(BlockGamePlayerAction.NewGame); }; menuContainer.AddChild(_newGameButton); - menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)}); + menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); _scoreBoardButton = new Button { @@ -259,7 +259,7 @@ namespace Content.Client.Arcade }; _scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores); menuContainer.AddChild(_scoreBoardButton); - _unpauseButtonMargin = new Control {CustomMinimumSize = new Vector2(1, 10), Visible = false}; + _unpauseButtonMargin = new Control {MinSize = new Vector2(1, 10), Visible = false}; menuContainer.AddChild(_unpauseButtonMargin); _unpauseButton = new Button @@ -301,35 +301,35 @@ namespace Content.Client.Arcade _levelLabel = new Label { Align = Label.AlignMode.Center, - SizeFlagsHorizontal = SizeFlags.FillExpand + HorizontalExpand = true }; _gameRootContainer.AddChild(_levelLabel); _gameRootContainer.AddChild(new Control { - CustomMinimumSize = new Vector2(1,5) + MinSize = new Vector2(1,5) }); _pointsLabel = new Label { Align = Label.AlignMode.Center, - SizeFlagsHorizontal = SizeFlags.FillExpand + HorizontalExpand = true }; _gameRootContainer.AddChild(_pointsLabel); _gameRootContainer.AddChild(new Control { - CustomMinimumSize = new Vector2(1,10) + MinSize = new Vector2(1,10) }); var gameBox = new HBoxContainer(); gameBox.AddChild(SetupHoldBox(backgroundTexture)); gameBox.AddChild(new Control { - CustomMinimumSize = new Vector2(10,1) + MinSize = new Vector2(10,1) }); gameBox.AddChild(SetupGameGrid(backgroundTexture)); gameBox.AddChild(new Control { - CustomMinimumSize = new Vector2(10,1) + MinSize = new Vector2(10,1) }); gameBox.AddChild(SetupNextBox(backgroundTexture)); @@ -337,7 +337,7 @@ namespace Content.Client.Arcade _gameRootContainer.AddChild(new Control { - CustomMinimumSize = new Vector2(1,10) + MinSize = new Vector2(1,10) }); _pauseButton = new Button @@ -369,7 +369,7 @@ namespace Content.Client.Arcade var gamePanel = new PanelContainer { PanelOverride = back, - SizeFlagsHorizontal = SizeFlags.FillExpand, + HorizontalExpand = true, SizeFlagsStretchRatio = 60 }; var backgroundPanel = new PanelContainer @@ -393,16 +393,16 @@ namespace Content.Client.Arcade var grid = new GridContainer { Columns = 1, - SizeFlagsHorizontal = SizeFlags.FillExpand, + HorizontalExpand = true, SizeFlagsStretchRatio = 20 }; var nextBlockPanel = new PanelContainer { PanelOverride = previewBack, - CustomMinimumSize = BlockSize * 6.5f, - SizeFlagsHorizontal = SizeFlags.None, - SizeFlagsVertical = SizeFlags.None + MinSize = BlockSize * 6.5f, + HorizontalAlignment = HAlignment.Left, + VerticalAlignment = VAlignment.Top }; var nextCenterContainer = new CenterContainer(); _nextBlockGrid = new GridContainer @@ -431,16 +431,16 @@ namespace Content.Client.Arcade var grid = new GridContainer { Columns = 1, - SizeFlagsHorizontal = SizeFlags.FillExpand, + HorizontalExpand = true, SizeFlagsStretchRatio = 20 }; var holdBlockPanel = new PanelContainer { PanelOverride = previewBack, - CustomMinimumSize = BlockSize * 6.5f, - SizeFlagsHorizontal = SizeFlags.None, - SizeFlagsVertical = SizeFlags.None + MinSize = BlockSize * 6.5f, + HorizontalAlignment = HAlignment.Left, + VerticalAlignment = VAlignment.Top }; var holdCenterContainer = new CenterContainer(); _holdBlockGrid = new GridContainer @@ -625,7 +625,7 @@ namespace Content.Client.Arcade _nextBlockGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = c}, - CustomMinimumSize = BlockSize, + MinSize = BlockSize, RectDrawClipMargin = 0 }); } @@ -647,7 +647,7 @@ namespace Content.Client.Arcade _holdBlockGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = c}, - CustomMinimumSize = BlockSize, + MinSize = BlockSize, RectDrawClipMargin = 0 }); } @@ -665,7 +665,7 @@ namespace Content.Client.Arcade _gameGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = c}, - CustomMinimumSize = BlockSize, + MinSize = BlockSize, RectDrawClipMargin = 0 }); } diff --git a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs index e8897e7ebd..588b8f4f8c 100644 --- a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs +++ b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs @@ -9,7 +9,6 @@ namespace Content.Client.Arcade { public class SpaceVillainArcadeMenu : SS14Window { - protected override Vector2? CustomSize => (400, 200); public SpaceVillainArcadeBoundUserInterface Owner { get; set; } private readonly Label _enemyNameLabel; @@ -21,6 +20,7 @@ namespace Content.Client.Arcade private readonly Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) { + MinSize = SetSize = (400, 200); Title = Loc.GetString("Space Villain"); Owner = owner; diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index 0269076663..7c4c650752 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -9,7 +9,7 @@ using Robust.Shared.Utility; namespace Content.Client.Chat { - public class ChatBox : MarginContainer + public class ChatBox : Control { public delegate void TextSubmitHandler(ChatBox chatBox, string text); @@ -23,7 +23,7 @@ namespace Content.Client.Chat public Button LocalButton { get; } public Button OOCButton { get; } public Button AdminButton { get; } - public Button DeadButton { get; } + public Button DeadButton { get; } /// /// Default formatting string for the ClientChatConsole. @@ -36,13 +36,6 @@ namespace Content.Client.Chat public ChatBox() { - /*MarginLeft = -475.0f; - MarginTop = 10.0f; - MarginRight = -10.0f; - MarginBottom = 235.0f; - - AnchorLeft = 1.0f; - AnchorRight = 1.0f;*/ MouseFilter = MouseFilterMode.Stop; var outerVBox = new VBoxContainer(); @@ -50,7 +43,7 @@ namespace Content.Client.Chat var panelContainer = new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#25252aaa")}, - SizeFlagsVertical = SizeFlags.FillExpand + VerticalExpand = true }; var vBox = new VBoxContainer(); panelContainer.AddChild(vBox); @@ -59,15 +52,8 @@ namespace Content.Client.Chat outerVBox.AddChild(panelContainer); outerVBox.AddChild(hBox); - - var contentMargin = new MarginContainer - { - MarginLeftOverride = 4, MarginRightOverride = 4, - SizeFlagsVertical = SizeFlags.FillExpand - }; - Contents = new OutputPanel(); - contentMargin.AddChild(Contents); - vBox.AddChild(contentMargin); + Contents = new OutputPanel {Margin = new Thickness(4, 0), VerticalExpand = true}; + vBox.AddChild(Contents); Input = new HistoryLineEdit(); Input.OnKeyBindDown += InputKeyBindDown; @@ -78,7 +64,8 @@ namespace Content.Client.Chat { Text = Loc.GetString("All"), Name = "ALL", - SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand, + HorizontalExpand = true, + HorizontalAlignment = HAlignment.Right, ToggleMode = true, }; diff --git a/Content.Client/Chat/SpeechBubble.cs b/Content.Client/Chat/SpeechBubble.cs index 581010b8d2..b2639281d5 100644 --- a/Content.Client/Chat/SpeechBubble.cs +++ b/Content.Client/Chat/SpeechBubble.cs @@ -74,17 +74,13 @@ namespace Content.Client.Chat ForceRunStyleUpdate(); - ContentHeight = bubble.CombinedMinimumSize.Y; + bubble.Measure(Vector2.Infinity); + ContentHeight = bubble.DesiredSize.Y; _verticalOffsetAchieved = -ContentHeight; } protected abstract Control BuildBubble(string text); - protected override Vector2 CalculateMinimumSize() - { - return (base.CalculateMinimumSize().X, 0); - } - protected override void FrameUpdate(FrameEventArgs args) { base.FrameUpdate(args); @@ -122,7 +118,7 @@ namespace Content.Client.Chat LayoutContainer.SetPosition(this, screenPos); var height = MathHelper.Clamp(lowerCenter.Y - screenPos.Y, 0, ContentHeight); - LayoutContainer.SetSize(this, (Size.X, height)); + SetHeight = height; } private void Die() diff --git a/Content.Client/ClientNotifyManager.cs b/Content.Client/ClientNotifyManager.cs index 6a647a82f8..d9c32ab9fa 100644 --- a/Content.Client/ClientNotifyManager.cs +++ b/Content.Client/ClientNotifyManager.cs @@ -102,7 +102,8 @@ namespace Content.Client }; _userInterfaceManager.PopupRoot.AddChild(label); - var minimumSize = label.CombinedMinimumSize; + label.Measure(Vector2.Infinity); + var minimumSize = label.DesiredSize; label.InitialPos = (coordinates.Position / _userInterfaceManager.UIScale) - minimumSize / 2; LayoutContainer.SetPosition(label, label.InitialPos); @@ -149,7 +150,7 @@ namespace Content.Client var position = Entity == null ? InitialPos - : (_eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates).Position / UIScale) - CombinedMinimumSize / 2; + : (_eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates).Position / UIScale) - DesiredSize / 2; LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft))); diff --git a/Content.Client/Command/CommunicationsConsoleMenu.cs b/Content.Client/Command/CommunicationsConsoleMenu.cs index 565f3ca670..8bfbea72a0 100644 --- a/Content.Client/Command/CommunicationsConsoleMenu.cs +++ b/Content.Client/Command/CommunicationsConsoleMenu.cs @@ -12,8 +12,6 @@ namespace Content.Client.Command { public class CommunicationsConsoleMenu : SS14Window { - protected override Vector2? CustomSize => new Vector2(600, 400); - private CommunicationsConsoleBoundUserInterface Owner { get; set; } private readonly CancellationTokenSource _timerCancelTokenSource = new(); public readonly Button EmergencyShuttleButton; @@ -21,25 +19,26 @@ namespace Content.Client.Command public CommunicationsConsoleMenu(CommunicationsConsoleBoundUserInterface owner) { + SetSize = MinSize = (600, 400); IoCManager.InjectDependencies(this); Title = Loc.GetString("Communications Console"); Owner = owner; - _countdownLabel = new RichTextLabel(){CustomMinimumSize = new Vector2(0, 200)}; + _countdownLabel = new RichTextLabel(){MinSize = new Vector2(0, 200)}; EmergencyShuttleButton = new Button(); EmergencyShuttleButton.OnPressed += (_) => Owner.EmergencyShuttleButtonPressed(); EmergencyShuttleButton.Disabled = !owner.CanCall; - var vbox = new VBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand}; + var vbox = new VBoxContainer() {HorizontalExpand = true, VerticalExpand = true}; vbox.AddChild(_countdownLabel); vbox.AddChild(EmergencyShuttleButton); - var hbox = new HBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand}; - hbox.AddChild(new Control(){CustomMinimumSize = new Vector2(100,0), SizeFlagsHorizontal = SizeFlags.FillExpand}); + var hbox = new HBoxContainer() {HorizontalExpand = true, VerticalExpand = true}; + hbox.AddChild(new Control(){MinSize = new Vector2(100,0), HorizontalExpand = true}); hbox.AddChild(vbox); - hbox.AddChild(new Control(){CustomMinimumSize = new Vector2(100,0), SizeFlagsHorizontal = SizeFlags.FillExpand}); + hbox.AddChild(new Control(){MinSize = new Vector2(100,0), HorizontalExpand = true}); Contents.AddChild(hbox); diff --git a/Content.Client/Construction/ConstructionMenu.xaml b/Content.Client/Construction/ConstructionMenu.xaml index 0794b6beb2..e4794cd1b3 100644 --- a/Content.Client/Construction/ConstructionMenu.xaml +++ b/Content.Client/Construction/ConstructionMenu.xaml @@ -1,27 +1,27 @@ - - - - - + + + + + - + - - - - - - - + + + + + + + - - -