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();
51 public Point FormLocation = new Point(0, 0);
52 public int SplitterDistance = 200;
53 public Size FormSize = new Size(600, 500);
54 public string StatusText = "";
55 public bool UseRecommendStatus = false;
56 public int Width1 = 48;
57 public int Width2 = 80;
58 public int Width3 = 290;
59 public int Width4 = 120;
60 public int Width5 = 50;
61 public int Width6 = 16;
62 public int Width7 = 32;
63 public int Width8 = 50;
64 public int DisplayIndex1 = 2;
65 public int DisplayIndex2 = 3;
66 public int DisplayIndex3 = 4;
67 public int DisplayIndex4 = 5;
68 public int DisplayIndex5 = 6;
69 public int DisplayIndex6 = 1;
70 public int DisplayIndex7 = 0;
71 public int DisplayIndex8 = 7;
72 public string BrowserPath = "";
73 public ProxyType ProxyType = ProxyType.IE;
74 public string ProxyAddress = "127.0.0.1";
75 public int ProxyPort = 80;
76 public string ProxyUser = "";
77 public bool StatusMultiline = false;
78 public int StatusTextHeight = 38;
79 public int PreviewDistance = -1;
82 public Font FontUnread = new Font(SystemFonts.DefaultFont, FontStyle.Bold | FontStyle.Underline);
83 public string FontUnreadStr
85 get { return this.FontToString(this.FontUnread); }
86 set { this.FontUnread = this.StringToFont(value); }
90 public Color ColorUnread = System.Drawing.SystemColors.ControlText;
91 public string ColorUnreadStr
93 get { return this.ColorToString(this.ColorUnread); }
94 set { this.ColorUnread = this.StringToColor(value); }
98 public Font FontRead = System.Drawing.SystemFonts.DefaultFont;
99 public string FontReadStr
101 get { return this.FontToString(this.FontRead); }
102 set { this.FontRead = this.StringToFont(value); }
106 public Color ColorRead = System.Drawing.SystemColors.ControlText;
107 public string ColorReadStr
109 get { return this.ColorToString(this.ColorRead); }
110 set { this.ColorRead = this.StringToColor(value); }
114 public Color ColorFav = Color.FromKnownColor(System.Drawing.KnownColor.Red);
115 public string ColorFavStr
117 get { return this.ColorToString(this.ColorFav); }
118 set { this.ColorFav = this.StringToColor(value); }
122 public Color ColorOWL = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
123 public string ColorOWLStr
125 get { return this.ColorToString(this.ColorOWL); }
126 set { this.ColorOWL = this.StringToColor(value); }
130 public Color ColorRetweet = Color.FromKnownColor(System.Drawing.KnownColor.Green);
131 public string ColorRetweetStr
133 get { return this.ColorToString(this.ColorRetweet); }
134 set { this.ColorRetweet = this.StringToColor(value); }
138 public Font FontDetail = System.Drawing.SystemFonts.DefaultFont;
139 public string FontDetailStr
141 get { return this.FontToString(this.FontDetail); }
142 set { this.FontDetail = this.StringToFont(value); }
146 public Color ColorSelf = Color.FromKnownColor(System.Drawing.KnownColor.AliceBlue);
147 public string ColorSelfStr
149 get { return this.ColorToString(this.ColorSelf); }
150 set { this.ColorSelf = this.StringToColor(value); }
154 public Color ColorAtSelf = Color.FromKnownColor(System.Drawing.KnownColor.AntiqueWhite);
155 public string ColorAtSelfStr
157 get { return this.ColorToString(this.ColorAtSelf); }
158 set { this.ColorAtSelf = this.StringToColor(value); }
162 public Color ColorTarget = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
163 public string ColorTargetStr
165 get { return this.ColorToString(this.ColorTarget); }
166 set { this.ColorTarget = this.StringToColor(value); }
170 public Color ColorAtTarget = Color.FromKnownColor(System.Drawing.KnownColor.LavenderBlush);
171 public string ColorAtTargetStr
173 get { return this.ColorToString(this.ColorAtTarget); }
174 set { this.ColorAtTarget = this.StringToColor(value); }
178 public Color ColorAtFromTarget = Color.FromKnownColor(System.Drawing.KnownColor.Honeydew);
179 public string ColorAtFromTargetStr
181 get { return this.ColorToString(this.ColorAtFromTarget); }
182 set { this.ColorAtFromTarget = this.StringToColor(value); }
186 public Color ColorAtTo = Color.FromKnownColor(System.Drawing.KnownColor.Pink);
187 public string ColorAtToStr
189 get { return this.ColorToString(this.ColorAtTo); }
190 set { this.ColorAtTo = this.StringToColor(value); }
194 public Color ColorInputBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
195 public string ColorInputBackcolorStr
197 get { return this.ColorToString(this.ColorInputBackcolor); }
198 set { this.ColorInputBackcolor = this.StringToColor(value); }
202 public Color ColorInputFont = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
203 public string ColorInputFontStr
205 get { return this.ColorToString(this.ColorInputFont); }
206 set { this.ColorInputFont = this.StringToColor(value); }
210 public Font FontInputFont = System.Drawing.SystemFonts.DefaultFont;
211 public string FontInputFontStr
213 get { return this.FontToString(this.FontInputFont); }
214 set { this.FontInputFont = this.StringToFont(value); }
218 public Color ColorListBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
219 public string ColorListBackcolorStr
221 get { return this.ColorToString(this.ColorListBackcolor); }
222 set { this.ColorListBackcolor = this.StringToColor(value); }
226 public Color ColorDetailBackcolor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
227 public string ColorDetailBackcolorStr
229 get { return this.ColorToString(this.ColorDetailBackcolor); }
230 set { this.ColorDetailBackcolor = this.StringToColor(value); }
234 public Color ColorDetail = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
235 public string ColorDetailStr
237 get { return this.ColorToString(this.ColorDetail); }
238 set { this.ColorDetail = this.StringToColor(value); }
242 public Color ColorDetailLink = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
243 public string ColorDetailLinkStr
245 get { return this.ColorToString(this.ColorDetailLink); }
246 set { this.ColorDetailLink = this.StringToColor(value); }
250 public Font FontUIGlobal = null;
253 /// [隠し設定] UI フォントを指定します
256 /// フォントによっては一部レイアウトが崩れるためこっそり追加
258 public string FontUIGlobalStr
260 get { return this.FontToString(this.FontUIGlobal); }
261 set { this.FontUIGlobal = this.StringToFont(value); }
265 public string ProxyPassword = "";
266 public string EncryptProxyPassword
270 string pwd = ProxyPassword;
271 if (string.IsNullOrEmpty(pwd)) pwd = "";
276 return MyCommon.EncryptString(pwd);
291 if (string.IsNullOrEmpty(pwd)) pwd = "";
296 pwd = MyCommon.DecryptString(pwd);
308 private FontConverter fontConverter = new FontConverter();
310 protected string FontToString(Font font)
312 return font != null ? this.fontConverter.ConvertToString(font) : null;
315 protected Font StringToFont(string str)
317 return str != null ? (Font)this.fontConverter.ConvertFromString(str) : null;
321 private ColorConverter colorConverter = new ColorConverter();
323 protected string ColorToString(Color color)
325 return this.colorConverter.ConvertToString(color);
328 protected Color StringToColor(string str)
330 return (Color)this.colorConverter.ConvertFromString(str);
333 public void Dispose()
336 GC.SuppressFinalize(this);
339 protected virtual void Dispose(bool disposing)
343 this.FontUnread.Dispose();
344 this.FontRead.Dispose();
345 this.FontDetail.Dispose();
346 this.FontInputFont.Dispose();