diff --git a/SoundSwitch/Framework/Banner/BannerPositionEnum.cs b/SoundSwitch/Framework/Banner/BannerPositionEnum.cs index c07fcff1fa..a7c09403ba 100644 --- a/SoundSwitch/Framework/Banner/BannerPositionEnum.cs +++ b/SoundSwitch/Framework/Banner/BannerPositionEnum.cs @@ -21,6 +21,7 @@ public enum BannerPositionEnum TopRight = 2, BottomLeft = 3, BottomCenter = 4, - BottomRight = 5 + BottomRight = 5, + Center = 6 } } \ No newline at end of file diff --git a/SoundSwitch/Framework/Banner/BannerPositionFactory.cs b/SoundSwitch/Framework/Banner/BannerPositionFactory.cs index 15267e3283..68b1a71850 100644 --- a/SoundSwitch/Framework/Banner/BannerPositionFactory.cs +++ b/SoundSwitch/Framework/Banner/BannerPositionFactory.cs @@ -27,11 +27,12 @@ public class BannerPositionFactory : AbstractFactory screen.Bounds.X + 50; public int PositionBottom(Screen screen, int height, int offset) => screen.Bounds.Height - height - PositionTop(screen, 0) - offset; public int PositionRight(Screen screen, int width) => screen.Bounds.Width - width - PositionLeft(screen); - public int PositionCenter(Screen screen, int width) => (screen.Bounds.Width - width) / 2; + public int PositionCenterH(Screen screen, int width) => (screen.Bounds.Width - width) / 2; + public int PositionCenterV(Screen screen, int height) => (screen.Bounds.Height - height) / 2; } } \ No newline at end of file diff --git a/SoundSwitch/Framework/Banner/Position/PositionBottomCenter.cs b/SoundSwitch/Framework/Banner/Position/PositionBottomCenter.cs index 9912a31c32..67020e9bbe 100644 --- a/SoundSwitch/Framework/Banner/Position/PositionBottomCenter.cs +++ b/SoundSwitch/Framework/Banner/Position/PositionBottomCenter.cs @@ -26,7 +26,7 @@ internal class PositionBottomCenter : APosition, IPosition public Point GetScreenPosition(Screen screen, int height, int width, int offset) { return new Point( - PositionCenter(screen, width), + PositionCenterH(screen, width), PositionBottom(screen, height, offset) ); } diff --git a/SoundSwitch/Framework/Banner/Position/PositionCenter.cs b/SoundSwitch/Framework/Banner/Position/PositionCenter.cs new file mode 100644 index 0000000000..9917109b9e --- /dev/null +++ b/SoundSwitch/Framework/Banner/Position/PositionCenter.cs @@ -0,0 +1,34 @@ +/******************************************************************** + * Copyright (C) 2015-2017 Antoine Aflalo + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + ********************************************************************/ + +using System.Drawing; +using System.Windows.Forms; +using SoundSwitch.Localization; + +namespace SoundSwitch.Framework.Banner.Position +{ + internal class PositionCenter : APosition, IPosition + { + public BannerPositionEnum TypeEnum => BannerPositionEnum.Center; + public string Label => SettingsStrings.position_option_center; + + public Point GetScreenPosition(Screen screen, int height, int width, int offset) + { + return new Point( + PositionCenterH(screen, width), + PositionCenterV(screen, height) + ); + } + } +} \ No newline at end of file diff --git a/SoundSwitch/Framework/Banner/Position/PositionTopCenter.cs b/SoundSwitch/Framework/Banner/Position/PositionTopCenter.cs index 7a1289cdba..056b4613fd 100644 --- a/SoundSwitch/Framework/Banner/Position/PositionTopCenter.cs +++ b/SoundSwitch/Framework/Banner/Position/PositionTopCenter.cs @@ -26,7 +26,7 @@ internal class PositionTopCenter : APosition, IPosition public Point GetScreenPosition(Screen screen, int height, int width, int offset) { return new Point( - PositionCenter(screen, width), + PositionCenterH(screen, width), PositionTop(screen, offset) ); } diff --git a/SoundSwitch/Localization/SettingsStrings.Designer.cs b/SoundSwitch/Localization/SettingsStrings.Designer.cs index e843e2c53f..242fb7a38a 100644 --- a/SoundSwitch/Localization/SettingsStrings.Designer.cs +++ b/SoundSwitch/Localization/SettingsStrings.Designer.cs @@ -646,6 +646,15 @@ internal static string position_option_bottomRight { } } + /// + /// Looks up a localized string similar to Center. + /// + internal static string position_option_center { + get { + return ResourceManager.GetString("position.option.center", resourceCulture); + } + } + /// /// Looks up a localized string similar to Top Center. /// diff --git a/SoundSwitch/Localization/SettingsStrings.resx b/SoundSwitch/Localization/SettingsStrings.resx index 336c840371..2dade14723 100644 --- a/SoundSwitch/Localization/SettingsStrings.resx +++ b/SoundSwitch/Localization/SettingsStrings.resx @@ -558,4 +558,7 @@ Restore the state of the system when the application is closed. If you need any help or further troubleshooting with SoundSwitch, you can visit the Help Discussion or Community Discord link, or help support us by visiting the Donate link below. + + Center + \ No newline at end of file