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()
42 return LoadSettings();
54 public SizeF ScaleDimension = SizeF.Empty;
56 public Point FormLocation = new Point(0, 0);
57 public int SplitterDistance = 200;
58 public Size FormSize = new Size(600, 500);
63 public string StatusText = "";
65 public bool UseRecommendStatus = false;
66 public int Width1 = 48;
67 public int Width2 = 80;
68 public int Width3 = 290;
69 public int Width4 = 120;
70 public int Width5 = 50;
71 public int Width6 = 16;
72 public int Width7 = 32;
73 public int Width8 = 50;
74 public int DisplayIndex1 = 2;
75 public int DisplayIndex2 = 3;
76 public int DisplayIndex3 = 4;
77 public int DisplayIndex4 = 5;
78 public int DisplayIndex5 = 6;
79 public int DisplayIndex6 = 1;
80 public int DisplayIndex7 = 0;
81 public int DisplayIndex8 = 7;
82 public string BrowserPath = "";
83 public ProxyType ProxyType = ProxyType.IE;
84 public string ProxyAddress = "127.0.0.1";
85 public int ProxyPort = 80;
86 public string ProxyUser = "";
87 public bool StatusMultiline = false;
88 public int StatusTextHeight = 38;
89 public int PreviewDistance = -1;
92 public Font FontUnread = new Font(SystemFonts.DefaultFont, FontStyle.Bold | FontStyle.Underline);
93 public string FontUnreadStr
95 get { return this.FontToString(this.FontUnread); }
96 set { this.FontUnread = this.StringToFont(value); }
100 public Color ColorUnread = System.Drawing.SystemColors.ControlText;
101 public string ColorUnreadStr
103 get { return this.ColorToString(this.ColorUnread); }
104 set { this.ColorUnread = this.StringToColor(value); }
108 public Font FontRead = System.Drawing.SystemFonts.DefaultFont;
109 public string FontReadStr
111 get { return this.FontToString(this.FontRead); }
112 set { this.FontRead = this.StringToFont(value); }
116 public Color ColorRead = System.Drawing.SystemColors.ControlText;
117 public string ColorReadStr
119 get { return this.ColorToString(this.ColorRead); }
120 set { this.ColorRead = this.StringToColor(value); }
124 public Color ColorFav = Color.FromKnownColor(System.Drawing.KnownColor.Red);
125 public string ColorFavStr
127 get { return this.ColorToString(this.ColorFav); }
128 set { this.ColorFav = this.StringToColor(value); }
132 public Color ColorOWL = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
133 public string ColorOWLStr
135 get { return this.ColorToString(this.ColorOWL); }
136 set { this.ColorOWL = this.StringToColor(value); }
140 public Color ColorRetweet = Color.FromKnownColor(System.Drawing.KnownColor.Green);
141 public string ColorRetweetStr
143 get { return this.ColorToString(this.ColorRetweet); }
144 set { this.ColorRetweet = this.StringToColor(value); }
148 public Font FontDetail = System.Drawing.SystemFonts.DefaultFont;
149 public string FontDetailStr
151 get { return this.FontToString(this.FontDetail); }
152 set { this.FontDetail = this.StringToFont(value); }
156 public Color ColorSelf = Color.FromKnownColor(System.Drawing.KnownColor.AliceBlue);
157 public string ColorSelfStr
159 get { return this.ColorToString(this.ColorSelf); }
160 set { this.ColorSelf = this.StringToColor(value); }
164 public Color ColorAtSelf = Color.FromKnownColor(System.Drawing.KnownColor.AntiqueWhite);
165 public string ColorAtSelfStr
167 get { return this.ColorToString(this.ColorAtSelf); }
168 set { this.ColorAtSelf = this.StringToColor(value); }
172 public Color ColorTarget = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
173 public string ColorTargetStr
175 get { return this.ColorToString(this.ColorTarget); }
176 set { this.ColorTarget = this.StringToColor(value); }
180 public Color ColorAtTarget = Color.FromKnownColor(System.Drawing.KnownColor.LavenderBlush);
181 public string ColorAtTargetStr
183 get { return this.ColorToString(this.ColorAtTarget); }
184 set { this.ColorAtTarget = this.StringToColor(value); }
188 public Color ColorAtFromTarget = Color.FromKnownColor(System.Drawing.KnownColor.Honeydew);
189 public string ColorAtFromTargetStr
191 get { return this.ColorToString(this.ColorAtFromTarget); }
192 set { this.ColorAtFromTarget = this.StringToColor(value); }
196 public Color ColorAtTo = Color.FromKnownColor(System.Drawing.KnownColor.Pink);
197 public string ColorAtToStr
199 get { return this.ColorToString(this.ColorAtTo); }
200 set { this.ColorAtTo = this.StringToColor(value); }
204 public Color ColorInputBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
205 public string ColorInputBackcolorStr
207 get { return this.ColorToString(this.ColorInputBackcolor); }
208 set { this.ColorInputBackcolor = this.StringToColor(value); }
212 public Color ColorInputFont = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
213 public string ColorInputFontStr
215 get { return this.ColorToString(this.ColorInputFont); }
216 set { this.ColorInputFont = this.StringToColor(value); }
220 public Font FontInputFont = System.Drawing.SystemFonts.DefaultFont;
221 public string FontInputFontStr
223 get { return this.FontToString(this.FontInputFont); }
224 set { this.FontInputFont = this.StringToFont(value); }
228 public Color ColorListBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
229 public string ColorListBackcolorStr
231 get { return this.ColorToString(this.ColorListBackcolor); }
232 set { this.ColorListBackcolor = this.StringToColor(value); }
236 public Color ColorDetailBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
237 public string ColorDetailBackcolorStr
239 get { return this.ColorToString(this.ColorDetailBackcolor); }
240 set { this.ColorDetailBackcolor = this.StringToColor(value); }
244 public Color ColorDetail = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
245 public string ColorDetailStr
247 get { return this.ColorToString(this.ColorDetail); }
248 set { this.ColorDetail = this.StringToColor(value); }
252 public Color ColorDetailLink = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
253 public string ColorDetailLinkStr
255 get { return this.ColorToString(this.ColorDetailLink); }
256 set { this.ColorDetailLink = this.StringToColor(value); }
260 public Font FontUIGlobal = null;
263 /// [隠し設定] UI フォントを指定します
266 /// フォントによっては一部レイアウトが崩れるためこっそり追加
268 public string FontUIGlobalStr
270 get { return this.FontToString(this.FontUIGlobal); }
271 set { this.FontUIGlobal = this.StringToFont(value); }
275 public string ProxyPassword = "";
276 public string EncryptProxyPassword
280 string pwd = ProxyPassword;
281 if (string.IsNullOrEmpty(pwd)) pwd = "";
286 return MyCommon.EncryptString(pwd);
301 if (string.IsNullOrEmpty(pwd)) pwd = "";
306 pwd = MyCommon.DecryptString(pwd);
318 private FontConverter fontConverter = new FontConverter();
320 protected string FontToString(Font font)
322 return font != null ? this.fontConverter.ConvertToString(font) : null;
325 protected Font StringToFont(string str)
327 return str != null ? (Font)this.fontConverter.ConvertFromString(str) : null;
331 private ColorConverter colorConverter = new ColorConverter();
333 protected string ColorToString(Color color)
335 return this.colorConverter.ConvertToString(color);
338 protected Color StringToColor(string str)
340 return (Color)this.colorConverter.ConvertFromString(str);
344 /// 指定されたスケールと SettingLocal.ScaleDimension のスケールとの拡大比を返します
346 public SizeF GetConfigScaleFactor(SizeF currentSizeDimension)
349 currentSizeDimension.Width / this.ScaleDimension.Width,
350 currentSizeDimension.Height / this.ScaleDimension.Height);
353 public void Dispose()
356 GC.SuppressFinalize(this);
359 protected virtual void Dispose(bool disposing)
363 this.FontUnread.Dispose();
364 this.FontRead.Dispose();
365 this.FontDetail.Dispose();
366 this.FontInputFont.Dispose();