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.
30 using System.Collections.Generic;
34 using System.Xml.Serialization;
35 using OpenTween.Connection;
39 public class SettingLocal : SettingBase<SettingLocal>, IDisposable
42 public static SettingLocal Load()
46 => SaveSettings(this);
52 public SizeF ScaleDimension = SizeF.Empty;
54 public Point FormLocation = new Point(0, 0);
55 public int SplitterDistance = 200;
56 public Size FormSize = new Size(600, 500);
61 public string StatusText = "";
63 public bool UseRecommendStatus = false;
64 public int Width1 = 48;
65 public int Width2 = 80;
66 public int Width3 = 290;
67 public int Width4 = 120;
68 public int Width5 = 50;
69 public int Width6 = 16;
70 public int Width7 = 32;
71 public int Width8 = 50;
72 public int DisplayIndex1 = 2;
73 public int DisplayIndex2 = 3;
74 public int DisplayIndex3 = 4;
75 public int DisplayIndex4 = 5;
76 public int DisplayIndex5 = 6;
77 public int DisplayIndex6 = 1;
78 public int DisplayIndex7 = 0;
79 public int DisplayIndex8 = 7;
80 public string BrowserPath = "";
81 public ProxyType ProxyType = ProxyType.IE;
82 public string ProxyAddress = "127.0.0.1";
83 public int ProxyPort = 80;
84 public string ProxyUser = "";
85 public bool StatusMultiline = false;
86 public int StatusTextHeight = 38;
87 public int PreviewDistance = -1;
90 public Font FontUnread = new Font(SystemFonts.DefaultFont, FontStyle.Bold | FontStyle.Underline);
91 public string FontUnreadStr
93 get => this.FontToString(this.FontUnread);
94 set => this.FontUnread = this.StringToFont(value);
98 public Color ColorUnread = System.Drawing.SystemColors.ControlText;
99 public string ColorUnreadStr
101 get => this.ColorToString(this.ColorUnread);
102 set => this.ColorUnread = this.StringToColor(value);
106 public Font FontRead = System.Drawing.SystemFonts.DefaultFont;
107 public string FontReadStr
109 get => this.FontToString(this.FontRead);
110 set => this.FontRead = this.StringToFont(value);
114 public Color ColorRead = System.Drawing.SystemColors.ControlText;
115 public string ColorReadStr
117 get => this.ColorToString(this.ColorRead);
118 set => this.ColorRead = this.StringToColor(value);
122 public Color ColorFav = Color.FromKnownColor(System.Drawing.KnownColor.Red);
123 public string ColorFavStr
125 get => this.ColorToString(this.ColorFav);
126 set => this.ColorFav = this.StringToColor(value);
130 public Color ColorOWL = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
131 public string ColorOWLStr
133 get => this.ColorToString(this.ColorOWL);
134 set => this.ColorOWL = this.StringToColor(value);
138 public Color ColorRetweet = Color.FromKnownColor(System.Drawing.KnownColor.Green);
139 public string ColorRetweetStr
141 get => this.ColorToString(this.ColorRetweet);
142 set => this.ColorRetweet = this.StringToColor(value);
146 public Font FontDetail = System.Drawing.SystemFonts.DefaultFont;
147 public string FontDetailStr
149 get => this.FontToString(this.FontDetail);
150 set => this.FontDetail = this.StringToFont(value);
154 public Color ColorSelf = Color.FromKnownColor(System.Drawing.KnownColor.AliceBlue);
155 public string ColorSelfStr
157 get => this.ColorToString(this.ColorSelf);
158 set => this.ColorSelf = this.StringToColor(value);
162 public Color ColorAtSelf = Color.FromKnownColor(System.Drawing.KnownColor.AntiqueWhite);
163 public string ColorAtSelfStr
165 get => this.ColorToString(this.ColorAtSelf);
166 set => this.ColorAtSelf = this.StringToColor(value);
170 public Color ColorTarget = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
171 public string ColorTargetStr
173 get => this.ColorToString(this.ColorTarget);
174 set => this.ColorTarget = this.StringToColor(value);
178 public Color ColorAtTarget = Color.FromKnownColor(System.Drawing.KnownColor.LavenderBlush);
179 public string ColorAtTargetStr
181 get => this.ColorToString(this.ColorAtTarget);
182 set => this.ColorAtTarget = this.StringToColor(value);
186 public Color ColorAtFromTarget = Color.FromKnownColor(System.Drawing.KnownColor.Honeydew);
187 public string ColorAtFromTargetStr
189 get => this.ColorToString(this.ColorAtFromTarget);
190 set => this.ColorAtFromTarget = this.StringToColor(value);
194 public Color ColorAtTo = Color.FromKnownColor(System.Drawing.KnownColor.Pink);
195 public string ColorAtToStr
197 get => this.ColorToString(this.ColorAtTo);
198 set => this.ColorAtTo = this.StringToColor(value);
202 public Color ColorInputBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
203 public string ColorInputBackcolorStr
205 get => this.ColorToString(this.ColorInputBackcolor);
206 set => this.ColorInputBackcolor = this.StringToColor(value);
210 public Color ColorInputFont = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
211 public string ColorInputFontStr
213 get => this.ColorToString(this.ColorInputFont);
214 set => this.ColorInputFont = this.StringToColor(value);
218 public Font FontInputFont = System.Drawing.SystemFonts.DefaultFont;
219 public string FontInputFontStr
221 get => this.FontToString(this.FontInputFont);
222 set => this.FontInputFont = this.StringToFont(value);
226 public Color ColorListBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
227 public string ColorListBackcolorStr
229 get => this.ColorToString(this.ColorListBackcolor);
230 set => this.ColorListBackcolor = this.StringToColor(value);
234 public Color ColorDetailBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
235 public string ColorDetailBackcolorStr
237 get => this.ColorToString(this.ColorDetailBackcolor);
238 set => this.ColorDetailBackcolor = this.StringToColor(value);
242 public Color ColorDetail = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
243 public string ColorDetailStr
245 get => this.ColorToString(this.ColorDetail);
246 set => this.ColorDetail = this.StringToColor(value);
250 public Color ColorDetailLink = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
251 public string ColorDetailLinkStr
253 get => this.ColorToString(this.ColorDetailLink);
254 set => this.ColorDetailLink = this.StringToColor(value);
258 public Font? FontUIGlobal = null;
261 /// [隠し設定] UI フォントを指定します
264 /// フォントによっては一部レイアウトが崩れるためこっそり追加
266 public string? FontUIGlobalStr
268 get => this.FontUIGlobal != null ? this.FontToString(this.FontUIGlobal) : null;
269 set => this.FontUIGlobal = value != null ? this.StringToFont(value) : null;
273 public string ProxyPassword = "";
274 public string EncryptProxyPassword
278 var pwd = ProxyPassword;
279 if (string.IsNullOrEmpty(pwd)) pwd = "";
284 return MyCommon.EncryptString(pwd);
299 if (string.IsNullOrEmpty(pwd)) pwd = "";
304 pwd = MyCommon.DecryptString(pwd);
316 /// 絵文字の表示に Twemoji (https://github.com/twitter/twemoji) を使用するか
318 public bool UseTwemoji = true;
321 private readonly FontConverter fontConverter = new FontConverter();
323 protected string FontToString(Font font)
324 => this.fontConverter.ConvertToString(font);
326 protected Font StringToFont(string str)
327 => (Font)this.fontConverter.ConvertFromString(str);
330 private readonly ColorConverter colorConverter = new ColorConverter();
332 protected string ColorToString(Color color)
333 => this.colorConverter.ConvertToString(color);
335 protected Color StringToColor(string str)
336 => (Color)this.colorConverter.ConvertFromString(str);
339 /// 指定されたスケールと SettingLocal.ScaleDimension のスケールとの拡大比を返します
341 public SizeF GetConfigScaleFactor(SizeF currentSizeDimension)
343 currentSizeDimension.Width / this.ScaleDimension.Width,
344 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();