1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 // (c) 2008-2011 Moz (@syo68k)
4 // (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 // (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 // (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 // (c) 2011 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
10 // This file is part of OpenTween.
12 // This program is free software; you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 3 of the License, or (at your option)
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 // Boston, MA 02110-1301, USA.
28 using System.Collections.Generic;
32 using System.Xml.Serialization;
33 using OpenTween.Connection;
37 public class SettingLocal : SettingBase<SettingLocal>, IDisposable
40 public static SettingLocal Load()
44 => SaveSettings(this);
50 public SizeF ScaleDimension = SizeF.Empty;
52 public Point FormLocation = new Point(0, 0);
53 public int SplitterDistance = 200;
54 public Size FormSize = new Size(600, 500);
59 public string StatusText = "";
61 public bool UseRecommendStatus = false;
62 public int Width1 = 48;
63 public int Width2 = 80;
64 public int Width3 = 290;
65 public int Width4 = 120;
66 public int Width5 = 50;
67 public int Width6 = 16;
68 public int Width7 = 32;
69 public int Width8 = 50;
70 public int DisplayIndex1 = 2;
71 public int DisplayIndex2 = 3;
72 public int DisplayIndex3 = 4;
73 public int DisplayIndex4 = 5;
74 public int DisplayIndex5 = 6;
75 public int DisplayIndex6 = 1;
76 public int DisplayIndex7 = 0;
77 public int DisplayIndex8 = 7;
78 public string BrowserPath = "";
79 public ProxyType ProxyType = ProxyType.IE;
80 public string ProxyAddress = "127.0.0.1";
81 public int ProxyPort = 80;
82 public string ProxyUser = "";
83 public bool StatusMultiline = false;
84 public int StatusTextHeight = 38;
85 public int PreviewDistance = -1;
88 public Font FontUnread = new Font(SystemFonts.DefaultFont, FontStyle.Bold | FontStyle.Underline);
89 public string FontUnreadStr
91 get => this.FontToString(this.FontUnread);
92 set => this.FontUnread = this.StringToFont(value);
96 public Color ColorUnread = System.Drawing.SystemColors.ControlText;
97 public string ColorUnreadStr
99 get => this.ColorToString(this.ColorUnread);
100 set => this.ColorUnread = this.StringToColor(value);
104 public Font FontRead = System.Drawing.SystemFonts.DefaultFont;
105 public string FontReadStr
107 get => this.FontToString(this.FontRead);
108 set => this.FontRead = this.StringToFont(value);
112 public Color ColorRead = System.Drawing.SystemColors.ControlText;
113 public string ColorReadStr
115 get => this.ColorToString(this.ColorRead);
116 set => this.ColorRead = this.StringToColor(value);
120 public Color ColorFav = Color.FromKnownColor(System.Drawing.KnownColor.Red);
121 public string ColorFavStr
123 get => this.ColorToString(this.ColorFav);
124 set => this.ColorFav = this.StringToColor(value);
128 public Color ColorOWL = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
129 public string ColorOWLStr
131 get => this.ColorToString(this.ColorOWL);
132 set => this.ColorOWL = this.StringToColor(value);
136 public Color ColorRetweet = Color.FromKnownColor(System.Drawing.KnownColor.Green);
137 public string ColorRetweetStr
139 get => this.ColorToString(this.ColorRetweet);
140 set => this.ColorRetweet = this.StringToColor(value);
144 public Font FontDetail = System.Drawing.SystemFonts.DefaultFont;
145 public string FontDetailStr
147 get => this.FontToString(this.FontDetail);
148 set => this.FontDetail = this.StringToFont(value);
152 public Color ColorSelf = Color.FromKnownColor(System.Drawing.KnownColor.AliceBlue);
153 public string ColorSelfStr
155 get => this.ColorToString(this.ColorSelf);
156 set => this.ColorSelf = this.StringToColor(value);
160 public Color ColorAtSelf = Color.FromKnownColor(System.Drawing.KnownColor.AntiqueWhite);
161 public string ColorAtSelfStr
163 get => this.ColorToString(this.ColorAtSelf);
164 set => this.ColorAtSelf = this.StringToColor(value);
168 public Color ColorTarget = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
169 public string ColorTargetStr
171 get => this.ColorToString(this.ColorTarget);
172 set => this.ColorTarget = this.StringToColor(value);
176 public Color ColorAtTarget = Color.FromKnownColor(System.Drawing.KnownColor.LavenderBlush);
177 public string ColorAtTargetStr
179 get => this.ColorToString(this.ColorAtTarget);
180 set => this.ColorAtTarget = this.StringToColor(value);
184 public Color ColorAtFromTarget = Color.FromKnownColor(System.Drawing.KnownColor.Honeydew);
185 public string ColorAtFromTargetStr
187 get => this.ColorToString(this.ColorAtFromTarget);
188 set => this.ColorAtFromTarget = this.StringToColor(value);
192 public Color ColorAtTo = Color.FromKnownColor(System.Drawing.KnownColor.Pink);
193 public string ColorAtToStr
195 get => this.ColorToString(this.ColorAtTo);
196 set => this.ColorAtTo = this.StringToColor(value);
200 public Color ColorInputBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
201 public string ColorInputBackcolorStr
203 get => this.ColorToString(this.ColorInputBackcolor);
204 set => this.ColorInputBackcolor = this.StringToColor(value);
208 public Color ColorInputFont = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
209 public string ColorInputFontStr
211 get => this.ColorToString(this.ColorInputFont);
212 set => this.ColorInputFont = this.StringToColor(value);
216 public Font FontInputFont = System.Drawing.SystemFonts.DefaultFont;
217 public string FontInputFontStr
219 get => this.FontToString(this.FontInputFont);
220 set => this.FontInputFont = this.StringToFont(value);
224 public Color ColorListBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
225 public string ColorListBackcolorStr
227 get => this.ColorToString(this.ColorListBackcolor);
228 set => this.ColorListBackcolor = this.StringToColor(value);
232 public Color ColorDetailBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
233 public string ColorDetailBackcolorStr
235 get => this.ColorToString(this.ColorDetailBackcolor);
236 set => this.ColorDetailBackcolor = this.StringToColor(value);
240 public Color ColorDetail = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
241 public string ColorDetailStr
243 get => this.ColorToString(this.ColorDetail);
244 set => this.ColorDetail = this.StringToColor(value);
248 public Color ColorDetailLink = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
249 public string ColorDetailLinkStr
251 get => this.ColorToString(this.ColorDetailLink);
252 set => this.ColorDetailLink = this.StringToColor(value);
256 public Font FontUIGlobal = null;
259 /// [隠し設定] UI フォントを指定します
262 /// フォントによっては一部レイアウトが崩れるためこっそり追加
264 public string FontUIGlobalStr
266 get => this.FontToString(this.FontUIGlobal);
267 set => this.FontUIGlobal = this.StringToFont(value);
271 public string ProxyPassword = "";
272 public string EncryptProxyPassword
276 string pwd = ProxyPassword;
277 if (string.IsNullOrEmpty(pwd)) pwd = "";
282 return MyCommon.EncryptString(pwd);
297 if (string.IsNullOrEmpty(pwd)) pwd = "";
302 pwd = MyCommon.DecryptString(pwd);
314 /// 絵文字の表示に Twemoji (https://github.com/twitter/twemoji) を使用するか
316 public bool UseTwemoji = true;
319 private readonly FontConverter fontConverter = new FontConverter();
321 protected string FontToString(Font font)
322 => font != null ? this.fontConverter.ConvertToString(font) : null;
324 protected Font StringToFont(string str)
325 => str != null ? (Font)this.fontConverter.ConvertFromString(str) : null;
328 private readonly ColorConverter colorConverter = new ColorConverter();
330 protected string ColorToString(Color color)
331 => this.colorConverter.ConvertToString(color);
333 protected Color StringToColor(string str)
334 => (Color)this.colorConverter.ConvertFromString(str);
337 /// 指定されたスケールと SettingLocal.ScaleDimension のスケールとの拡大比を返します
339 public SizeF GetConfigScaleFactor(SizeF currentSizeDimension)
342 currentSizeDimension.Width / this.ScaleDimension.Width,
343 currentSizeDimension.Height / this.ScaleDimension.Height);
346 public void Dispose()
349 GC.SuppressFinalize(this);
352 protected virtual void Dispose(bool disposing)
356 this.FontUnread.Dispose();
357 this.FontRead.Dispose();
358 this.FontDetail.Dispose();
359 this.FontInputFont.Dispose();