Server/DisplaySettings.cs
author StephaneLenclud
Tue, 30 Aug 2016 16:50:37 +0200
changeset 260 d44943088c67
parent 123 0df386e37e29
permissions -rw-r--r--
Adding user given name to EAR events and enabling User Events.
StephaneLenclud@123
     1
//
StephaneLenclud@123
     2
// Copyright (C) 2014-2015 Stéphane Lenclud.
StephaneLenclud@123
     3
//
StephaneLenclud@123
     4
// This file is part of SharpDisplayManager.
StephaneLenclud@123
     5
//
StephaneLenclud@123
     6
// SharpDisplayManager is free software: you can redistribute it and/or modify
StephaneLenclud@123
     7
// it under the terms of the GNU General Public License as published by
StephaneLenclud@123
     8
// the Free Software Foundation, either version 3 of the License, or
StephaneLenclud@123
     9
// (at your option) any later version.
StephaneLenclud@123
    10
//
StephaneLenclud@123
    11
// SharpDisplayManager is distributed in the hope that it will be useful,
StephaneLenclud@123
    12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
StephaneLenclud@123
    13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
StephaneLenclud@123
    14
// GNU General Public License for more details.
StephaneLenclud@123
    15
//
StephaneLenclud@123
    16
// You should have received a copy of the GNU General Public License
StephaneLenclud@123
    17
// along with SharpDisplayManager.  If not, see <http://www.gnu.org/licenses/>.
StephaneLenclud@123
    18
//
StephaneLenclud@123
    19
StephaneLenclud@123
    20
using System;
sl@49
    21
using System.Collections;
sl@49
    22
using System.Collections.Generic;
sl@49
    23
using System.Text;
sl@49
    24
using System.Configuration;
sl@49
    25
using System.Xml;
sl@49
    26
using System.ComponentModel;
sl@49
    27
using System.Runtime.Serialization;
sl@49
    28
using System.Runtime.Serialization.Json;
sl@49
    29
using System.IO;
sl@49
    30
using System.Drawing;
Stephane@212
    31
using SharpLib.Utils;
sl@49
    32
sl@49
    33
namespace SharpDisplayManager
sl@49
    34
{
sl@49
    35
    /// <summary>
sl@50
    36
    /// Display settings for the specified hardware type
sl@49
    37
    /// </summary>
sl@49
    38
    [DataContract]
sl@50
    39
    public class DisplaySettings
sl@49
    40
    {
sl@50
    41
        public DisplaySettings()
sl@49
    42
        {
sl@49
    43
            Brightness = 1;
sl@49
    44
            DisplayType = 0;
sl@49
    45
            TimerInterval = 150;
sl@49
    46
            ReverseScreen = false;
sl@57
    47
            InverseColors = true;
sl@49
    48
            ShowBorders = false;
StephaneLenclud@115
    49
			ShowVolumeLabel = false;
sl@49
    50
            FontName = "Microsoft Sans Serif, 9.75pt";
sl@100
    51
            ScaleToFit = true;
sl@100
    52
            MinFontSize = 15.0f;
StephaneLenclud@106
    53
            Separator = "   ";
StephaneLenclud@106
    54
			ScrollingSpeedInPixelsPerSecond = 64;
sl@49
    55
        }
sl@49
    56
StephaneLenclud@115
    57
StephaneLenclud@115
    58
		[DataMember]
StephaneLenclud@115
    59
		public bool ShowVolumeLabel { get; set; }
StephaneLenclud@115
    60
sl@49
    61
        [DataMember]
sl@49
    62
        public int Brightness { get; set; }
sl@49
    63
sl@50
    64
        /// <summary>
sl@50
    65
        /// See Display.TMiniDisplayType
sl@50
    66
        /// </summary>
sl@49
    67
        [DataMember]
sl@49
    68
        public int DisplayType { get; set; }
sl@49
    69
sl@49
    70
        [DataMember]
sl@49
    71
        public int TimerInterval { get; set; }
sl@49
    72
StephaneLenclud@106
    73
		[DataMember]
StephaneLenclud@106
    74
		public int ScrollingSpeedInPixelsPerSecond { get; set; }
StephaneLenclud@106
    75
sl@49
    76
        [DataMember]
sl@49
    77
        public bool ReverseScreen { get; set; }
sl@49
    78
sl@49
    79
        [DataMember]
sl@57
    80
        public bool InverseColors { get; set; }
sl@57
    81
sl@57
    82
        [DataMember]
sl@49
    83
        public bool ShowBorders { get; set; }
sl@49
    84
sl@49
    85
        [DataMember]
sl@100
    86
        public bool ScaleToFit { get; set; }
sl@100
    87
sl@100
    88
        [DataMember]
sl@100
    89
        public float MinFontSize { get; set; }
sl@100
    90
sl@100
    91
        [DataMember]
sl@100
    92
        public string Separator { get; set; }
sl@100
    93
sl@100
    94
        [DataMember]
sl@49
    95
        public string FontName { get; set; }
sl@49
    96
sl@49
    97
        public Font Font
sl@49
    98
        {
sl@49
    99
            get
sl@49
   100
            {
sl@49
   101
                FontConverter cvt = new FontConverter();
sl@49
   102
                Font font = cvt.ConvertFromInvariantString(FontName) as Font;
sl@49
   103
                return font;
sl@49
   104
            }
sl@49
   105
sl@49
   106
            set
sl@49
   107
            {
sl@49
   108
                FontConverter cvt = new FontConverter();
sl@49
   109
                FontName = cvt.ConvertToInvariantString(value);
sl@49
   110
            }
sl@49
   111
        }
sl@49
   112
    };
sl@49
   113
sl@49
   114
sl@50
   115
    /// <summary>
sl@100
   116
    /// Contain settings for each of our display type.
sl@50
   117
    /// </summary>
Stephane@212
   118
    [TypeConverter(typeof(TypeConverterJson<DisplaysSettings>))]
sl@49
   119
    [DataContract]
sl@50
   120
    public class DisplaysSettings
sl@49
   121
    {
Stephane@212
   122
        private List<DisplaySettings> iDisplays;
Stephane@212
   123
sl@50
   124
        public DisplaysSettings()
sl@49
   125
        {
sl@49
   126
            Init();
sl@49
   127
        }
sl@49
   128
sl@49
   129
        public void Init()
sl@49
   130
        {
Stephane@212
   131
            if (iDisplays == null)
sl@49
   132
            {
Stephane@212
   133
                iDisplays = new List<DisplaySettings>();
sl@49
   134
            }
sl@49
   135
        }
sl@49
   136
sl@49
   137
        //[DataMember]
sl@49
   138
        //public int CurrentSettingsIndex { get; set; }
sl@49
   139
sl@49
   140
        [DataMember]
Stephane@212
   141
        public List<DisplaySettings> Displays { get { Init(); return iDisplays; } private set { iDisplays = value; } }
sl@49
   142
Stephane@212
   143
sl@49
   144
    }
sl@49
   145
}
sl@49
   146