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