OSDN Git Service

usingの順序を揃える (SA1208, SA1210)
[opentween/open-tween.git] / OpenTween / Setting / Panel / FontPanel.cs
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) 2014      kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
9 //
10 // This file is part of OpenTween.
11 //
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)
15 // any later version.
16 //
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
20 // for more details.
21 //
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.
26
27 #nullable enable
28
29 using System;
30 using System.Collections.Generic;
31 using System.ComponentModel;
32 using System.Data;
33 using System.Drawing;
34 using System.Linq;
35 using System.Text;
36 using System.Windows.Forms;
37
38 namespace OpenTween.Setting.Panel
39 {
40     public partial class FontPanel : SettingPanelBase
41     {
42         public FontPanel()
43             => this.InitializeComponent();
44
45         public void LoadConfig(SettingLocal settingLocal)
46         {
47             this.lblListFont.Font = settingLocal.FontRead;
48             this.lblUnread.Font = settingLocal.FontUnread;
49             this.lblUnread.ForeColor = settingLocal.ColorUnread;
50             this.lblListFont.ForeColor = settingLocal.ColorRead;
51             this.lblFav.ForeColor = settingLocal.ColorFav;
52             this.lblOWL.ForeColor = settingLocal.ColorOWL;
53             this.lblRetweet.ForeColor = settingLocal.ColorRetweet;
54             this.lblDetail.Font = settingLocal.FontDetail;
55             this.lblDetailBackcolor.BackColor = settingLocal.ColorDetailBackcolor;
56             this.lblDetail.ForeColor = settingLocal.ColorDetail;
57             this.lblDetailLink.ForeColor = settingLocal.ColorDetailLink;
58             this.checkBoxUseTwemoji.Checked = settingLocal.UseTwemoji;
59         }
60
61         public void SaveConfig(SettingLocal settingLocal)
62         {
63             settingLocal.FontUnread = this.lblUnread.Font; // 未使用
64             settingLocal.ColorUnread = this.lblUnread.ForeColor;
65             settingLocal.FontRead = this.lblListFont.Font; // リストフォントとして使用
66             settingLocal.ColorRead = this.lblListFont.ForeColor;
67             settingLocal.ColorFav = this.lblFav.ForeColor;
68             settingLocal.ColorOWL = this.lblOWL.ForeColor;
69             settingLocal.ColorRetweet = this.lblRetweet.ForeColor;
70             settingLocal.FontDetail = this.lblDetail.Font;
71             settingLocal.ColorDetailBackcolor = this.lblDetailBackcolor.BackColor;
72             settingLocal.ColorDetail = this.lblDetail.ForeColor;
73             settingLocal.ColorDetailLink = this.lblDetailLink.ForeColor;
74             settingLocal.UseTwemoji = this.checkBoxUseTwemoji.Checked;
75         }
76
77         private void ButtonBackToDefaultFontColor_Click(object sender, EventArgs e)
78         {
79             this.lblUnread.ForeColor = SystemColors.ControlText;
80             this.lblUnread.Font = new Font(SystemFonts.DefaultFont, FontStyle.Bold | FontStyle.Underline);
81
82             this.lblListFont.ForeColor = System.Drawing.SystemColors.ControlText;
83             this.lblListFont.Font = System.Drawing.SystemFonts.DefaultFont;
84
85             this.lblDetail.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
86             this.lblDetail.Font = System.Drawing.SystemFonts.DefaultFont;
87             this.checkBoxUseTwemoji.Checked = true;
88
89             this.lblFav.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Red);
90
91             this.lblOWL.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
92
93             this.lblDetailBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
94
95             this.lblDetailLink.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
96
97             this.lblRetweet.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Green);
98         }
99
100         private void btnListFont_Click(object sender, EventArgs e)
101             => this.ShowFontDialog(this.lblListFont);
102
103         private void btnUnread_Click(object sender, EventArgs e)
104             => this.ShowFontDialog(this.lblUnread);
105
106         private void btnFav_Click(object sender, EventArgs e)
107             => this.ShowForeColorDialog(this.lblFav);
108
109         private void btnOWL_Click(object sender, EventArgs e)
110             => this.ShowForeColorDialog(this.lblOWL);
111
112         private void btnRetweet_Click(object sender, EventArgs e)
113             => this.ShowForeColorDialog(this.lblRetweet);
114
115         private void btnDetail_Click(object sender, EventArgs e)
116             => this.ShowFontDialog(this.lblDetail);
117
118         private void btnDetailLink_Click(object sender, EventArgs e)
119             => this.ShowForeColorDialog(this.lblDetailLink);
120
121         private void btnDetailBack_Click(object sender, EventArgs e)
122             => this.ShowBackColorDialog(this.lblDetailBackcolor);
123     }
124 }