OSDN Git Service

usingの順序を揃える (SA1208, SA1210)
[opentween/open-tween.git] / OpenTween / Setting / Panel / TweetActPanel.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 TweetActPanel : SettingPanelBase
41     {
42         public TweetActPanel()
43             => this.InitializeComponent();
44
45         public void LoadConfig(SettingCommon settingCommon, SettingLocal settingLocal)
46         {
47             this.StatusText.Text = settingLocal.StatusText;
48
49             if (settingCommon.PostCtrlEnter)
50             {
51                 this.ComboBoxPostKeySelect.SelectedIndex = 1;
52             }
53             else if (settingCommon.PostShiftEnter)
54             {
55                 this.ComboBoxPostKeySelect.SelectedIndex = 2;
56             }
57             else
58             {
59                 this.ComboBoxPostKeySelect.SelectedIndex = 0;
60             }
61
62             this.CheckUseRecommendStatus.Checked = settingLocal.UseRecommendStatus;
63             this.CheckRetweetNoConfirm.Checked = settingCommon.RetweetNoConfirm;
64             this.CheckAtIdSupple.Checked = settingCommon.UseAtIdSupplement;
65             this.CheckHashSupple.Checked = settingCommon.UseHashSupplement;
66             this.CheckAlphaPNGWorkaround.Checked = settingCommon.AlphaPNGWorkaround;
67         }
68
69         public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
70         {
71             settingLocal.StatusText = this.StatusText.Text;
72
73             switch (this.ComboBoxPostKeySelect.SelectedIndex)
74             {
75                 case 2:
76                     settingCommon.PostShiftEnter = true;
77                     settingCommon.PostCtrlEnter = false;
78                     break;
79                 case 1:
80                     settingCommon.PostCtrlEnter = true;
81                     settingCommon.PostShiftEnter = false;
82                     break;
83                 case 0:
84                     settingCommon.PostCtrlEnter = false;
85                     settingCommon.PostShiftEnter = false;
86                     break;
87             }
88
89             settingLocal.UseRecommendStatus = this.CheckUseRecommendStatus.Checked;
90             settingCommon.RetweetNoConfirm = this.CheckRetweetNoConfirm.Checked;
91             settingCommon.UseAtIdSupplement = this.CheckAtIdSupple.Checked;
92             settingCommon.UseHashSupplement = this.CheckHashSupple.Checked;
93             settingCommon.AlphaPNGWorkaround = this.CheckAlphaPNGWorkaround.Checked;
94         }
95
96         private void CheckUseRecommendStatus_CheckedChanged(object sender, EventArgs e)
97         {
98             if (this.CheckUseRecommendStatus.Checked == true)
99             {
100                 this.StatusText.Enabled = false;
101             }
102             else
103             {
104                 this.StatusText.Enabled = true;
105             }
106         }
107     }
108 }