#region << Using Directives >>
using System;
using System.Drawing;
using System.Windows.Forms;
#endregion

namespace Volpe.Cafe.EspressoUI.Utils
{
    [Serializable]
    static class GlobalSettings
    {

        #region /*** Ctors ***/

        static GlobalSettings()
        {
            // set starting GUI size relative to screen resolution (capped at 1200px wide)
            int w = Math.Min(1200, Screen.PrimaryScreen.Bounds.Width / 2);
            PreferredSize = new Size(w, w * 2 / 3);
            SplashScreenSize = new Size(w, w * 2 / 3);
            DialogSize = new Size(640, 480);

            // get DPI scale
            using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
            {
                DPIScale = (96F / g.DpiX);
            }
        }

        #endregion

        #region /*** Variables ***/

        /// <summary>
        /// Gets the preferred size for the main CAFE Model GUI.
        /// </summary>
        public static readonly Size PreferredSize;
        /// <summary>
        /// Gets the preferred size for the splash screen.
        /// </summary>
        public static readonly Size SplashScreenSize;
        /// <summary>
        /// Gets the preferred size for the CAFE Model informational dialogs.
        /// </summary>
        public static readonly Size DialogSize;
        /// <summary>
        /// Gets the ratio of the default DPI scaling setting (96 dpi) and the system's current DPI scaling setting.
        /// </summary>
        /// <remarks>
        /// The system's DPI scaling breaks fixed positioning of GUI controls. The DPIScale variable is used to adjust
        /// the UI fonts to the dimensions to which the application was designed to.
        /// </remarks>
        public static readonly float DPIScale;

        #endregion

    }
}
