OSDN Git Service

TweetActPanelに対する設定値の設定・取得を LoadConfing/SaveConfig メソッドに移動
authorKimura Youichi <kim.upsilon@bucyou.net>
Sun, 27 Jul 2014 00:05:35 +0000 (09:05 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Thu, 31 Jul 2014 16:16:40 +0000 (01:16 +0900)
OpenTween/AppendSettingDialog.cs
OpenTween/Setting/Panel/TweetActPanel.cs
OpenTween/Setting/SettingLocal.cs
OpenTween/Tween.cs

index 019697f..55dba2a 100644 (file)
@@ -77,6 +77,7 @@ namespace OpenTween
             this.GetPeriodPanel.LoadConfig(settingCommon);
             this.StartupPanel.LoadConfig(settingCommon);
             this.TweetPrvPanel.LoadConfig(settingCommon);
+            this.TweetActPanel.LoadConfig(settingCommon, settingLocal);
         }
 
         public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
@@ -84,6 +85,7 @@ namespace OpenTween
             this.GetPeriodPanel.SaveConfig(settingCommon);
             this.StartupPanel.SaveConfig(settingCommon);
             this.TweetPrvPanel.SaveConfig(settingCommon);
+            this.TweetActPanel.SaveConfig(settingCommon, settingLocal);
         }
 
         private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
@@ -209,7 +211,6 @@ namespace OpenTween
 #endif
             try
             {
-                Status = this.TweetActPanel.StatusText.Text;
                 PlaySound = this.ActionPanel.PlaySnd.Checked;
                 UnreadManage = this.ActionPanel.UReadMng.Checked;
 
@@ -247,25 +248,9 @@ namespace OpenTween
                         break;
                 }
 
-                switch (this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex)
-                {
-                    case 2:
-                        PostShiftEnter = true;
-                        PostCtrlEnter = false;
-                        break;
-                    case 1:
-                        PostCtrlEnter = true;
-                        PostShiftEnter = false;
-                        break;
-                    case 0:
-                        PostCtrlEnter = false;
-                        PostShiftEnter = false;
-                        break;
-                }
                 CountApi = int.Parse(this.GetCountPanel.TextCountApi.Text);
                 CountApiReply = int.Parse(this.GetCountPanel.TextCountApiReply.Text);
                 BrowserPath = this.ActionPanel.BrowserPathText.Text.Trim();
-                UseRecommendStatus = this.TweetActPanel.CheckUseRecommendStatus.Checked;
                 DispUsername = this.PreviewPanel.CheckDispUsername.Checked;
                 CloseToExit = this.ActionPanel.CheckCloseToExit.Checked;
                 MinimizeToTray = this.ActionPanel.CheckMinimizeToTray.Checked;
@@ -321,7 +306,6 @@ namespace OpenTween
 
                 Nicoms = this.CooperatePanel.CheckNicoms.Checked;
                 DefaultTimeOut = int.Parse(this.ConnectionPanel.ConnectionTimeOut.Text);
-                RetweetNoConfirm = this.TweetActPanel.CheckRetweetNoConfirm.Checked;
                 LimitBalloon = this.PreviewPanel.CheckBalloonLimit.Checked;
                 EventNotifyEnabled = this.NotifyPanel.CheckEventNotify.Checked;
                 GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
@@ -336,8 +320,6 @@ namespace OpenTween
                 ReadOldPosts = this.ActionPanel.CheckReadOldPosts.Checked;
                 BitlyUser = this.ShortUrlPanel.TextBitlyId.Text;
                 BitlyPwd = this.ShortUrlPanel.TextBitlyPw.Text;
-                UseAtIdSupplement = this.TweetActPanel.CheckAtIdSupple.Checked;
-                UseHashSupplement = this.TweetActPanel.CheckHashSupple.Checked;
                 PreviewEnable = this.PreviewPanel.CheckPreviewEnable.Checked;
                 StatusAreaAtBottom = this.PreviewPanel.CheckStatusAreaAtBottom.Checked;
                 TwitterApiUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
@@ -505,7 +487,6 @@ namespace OpenTween
                 }
             }
 
-            this.TweetActPanel.StatusText.Text = Status;
             this.ActionPanel.UReadMng.Checked = UnreadManage;
             this.ActionPanel.PlaySnd.Checked = PlaySound;
 
@@ -544,23 +525,9 @@ namespace OpenTween
                     break;
             }
 
-            if (PostCtrlEnter)
-            {
-                this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 1;
-            }
-            else if (PostShiftEnter)
-            {
-                this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 2;
-            }
-            else
-            {
-                this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 0;
-            }
-
             this.GetCountPanel.TextCountApi.Text = CountApi.ToString();
             this.GetCountPanel.TextCountApiReply.Text = CountApiReply.ToString();
             this.ActionPanel.BrowserPathText.Text = BrowserPath;
-            this.TweetActPanel.CheckUseRecommendStatus.Checked = UseRecommendStatus;
             this.PreviewPanel.CheckDispUsername.Checked = DispUsername;
             this.ActionPanel.CheckCloseToExit.Checked = CloseToExit;
             this.ActionPanel.CheckMinimizeToTray.Checked = MinimizeToTray;
@@ -627,7 +594,6 @@ namespace OpenTween
 
             this.CooperatePanel.CheckNicoms.Checked = Nicoms;
             this.ConnectionPanel.ConnectionTimeOut.Text = DefaultTimeOut.ToString();
-            this.TweetActPanel.CheckRetweetNoConfirm.Checked = RetweetNoConfirm;
             this.PreviewPanel.CheckBalloonLimit.Checked = LimitBalloon;
 
             ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
@@ -644,8 +610,6 @@ namespace OpenTween
             this.ShortUrlPanel.TextBitlyPw.Text = BitlyPwd;
             this.ShortUrlPanel.TextBitlyId.Modified = false;
             this.ShortUrlPanel.TextBitlyPw.Modified = false;
-            this.TweetActPanel.CheckAtIdSupple.Checked = UseAtIdSupplement;
-            this.TweetActPanel.CheckHashSupple.Checked = UseHashSupplement;
             this.PreviewPanel.CheckPreviewEnable.Checked = PreviewEnable;
             this.PreviewPanel.CheckStatusAreaAtBottom.Checked = StatusAreaAtBottom;
             this.ConnectionPanel.TwitterAPIText.Text = TwitterApiUrl;
@@ -943,7 +907,6 @@ namespace OpenTween
             }
         }
 
-        public string Status { get; set; }
         public bool UnreadManage { get; set; }
         public bool PlaySound { get; set; }
         public Font FontUnread { get; set; } /////未使用
@@ -968,8 +931,6 @@ namespace OpenTween
         public Color ColorListBackcolor { get; set; }
         public Color ColorDetailBackcolor { get; set; }
         public MyCommon.NameBalloonEnum NameBalloon { get; set; }
-        public bool PostCtrlEnter { get; set; }
-        public bool PostShiftEnter { get; set; }
         public int CountApi { get; set; }
         public int CountApiReply { get; set; }
         public int MoreCountApi { get; set; }
@@ -978,7 +939,6 @@ namespace OpenTween
         public int FavoritesCountApi { get; set; }
         public int UserTimelineCountApi { get; set; }
         public int ListCountApi { get; set; }
-        public bool UseRecommendStatus { get; set; }
         public string RecommendStatusText { get; set; }
         public bool DispUsername { get; set; }
         public bool CloseToExit { get; set; }
@@ -1008,7 +968,6 @@ namespace OpenTween
         public bool Nicoms { get; set; }
         public MyCommon.UrlConverter AutoShortUrlFirst { get; set; }
         public int DefaultTimeOut { get; set; }
-        public bool RetweetNoConfirm { get; set; }
         public bool TabIconDisp { get; set; }
         public MyCommon.REPLY_ICONSTATE ReplyIconState { get; set; }
         public bool ReadOwnPost { get; set; }
@@ -1016,8 +975,6 @@ namespace OpenTween
         public bool ReadOldPosts { get; set; }
         public string BitlyUser { get; set; }
         public string BitlyPwd { get; set; }
-        public bool UseAtIdSupplement { get; set; }
-        public bool UseHashSupplement { get; set; }
         public bool PreviewEnable { get; set; }
         public bool StatusAreaAtBottom { get; set; }
         public bool UseAdditionalCount { get; set; }
index f0ffd3a..2a05a92 100644 (file)
@@ -42,6 +42,55 @@ namespace OpenTween.Setting.Panel
             InitializeComponent();
         }
 
+        public void LoadConfig(SettingCommon settingCommon, SettingLocal settingLocal)
+        {
+            this.StatusText.Text = settingLocal.StatusText;
+
+            if (settingCommon.PostCtrlEnter)
+            {
+                this.ComboBoxPostKeySelect.SelectedIndex = 1;
+            }
+            else if (settingCommon.PostShiftEnter)
+            {
+                this.ComboBoxPostKeySelect.SelectedIndex = 2;
+            }
+            else
+            {
+                this.ComboBoxPostKeySelect.SelectedIndex = 0;
+            }
+
+            this.CheckUseRecommendStatus.Checked = settingLocal.UseRecommendStatus;
+            this.CheckRetweetNoConfirm.Checked = settingCommon.RetweetNoConfirm;
+            this.CheckAtIdSupple.Checked = settingCommon.UseAtIdSupplement;
+            this.CheckHashSupple.Checked = settingCommon.UseHashSupplement;
+        }
+
+        public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
+        {
+            settingLocal.StatusText = this.StatusText.Text;
+
+            switch (this.ComboBoxPostKeySelect.SelectedIndex)
+            {
+                case 2:
+                    settingCommon.PostShiftEnter = true;
+                    settingCommon.PostCtrlEnter = false;
+                    break;
+                case 1:
+                    settingCommon.PostCtrlEnter = true;
+                    settingCommon.PostShiftEnter = false;
+                    break;
+                case 0:
+                    settingCommon.PostCtrlEnter = false;
+                    settingCommon.PostShiftEnter = false;
+                    break;
+            }
+
+            settingLocal.UseRecommendStatus = this.CheckUseRecommendStatus.Checked;
+            settingCommon.RetweetNoConfirm = this.CheckRetweetNoConfirm.Checked;
+            settingCommon.UseAtIdSupplement = this.CheckAtIdSupple.Checked;
+            settingCommon.UseHashSupplement = this.CheckHashSupple.Checked;
+        }
+
         private void CheckUseRecommendStatus_CheckedChanged(object sender, EventArgs e)
         {
             if (CheckUseRecommendStatus.Checked == true)
index 8bfb1bb..5cdf773 100644 (file)
@@ -51,7 +51,12 @@ namespace OpenTween
         public Point FormLocation = new Point(0, 0);
         public int SplitterDistance = 200;
         public Size FormSize = new Size(600, 500);
+
+        /// <summary>
+        /// 文末ステータス
+        /// </summary>
         public string StatusText = "";
+
         public bool UseRecommendStatus = false;
         public int Width1 = 48;
         public int Width2 = 80;
index ef73449..eebdbc4 100644 (file)
@@ -766,8 +766,6 @@ namespace OpenTween
             //新着取得時のリストスクロールをするか。trueならスクロールしない
             ListLockMenuItem.Checked = _cfgCommon.ListLock;
             this.LockListFileMenuItem.Checked = _cfgCommon.ListLock;
-            //文末ステータス
-            SettingDialog.Status = _cfgLocal.StatusText;
             //未読管理。trueなら未読管理する
             SettingDialog.UnreadManage = _cfgCommon.UnreadManage;
             //サウンド再生(タブ別設定より優先)
@@ -798,8 +796,6 @@ namespace OpenTween
             SettingDialog.FontInputFont = _fntInputFont;
 
             SettingDialog.NameBalloon = _cfgCommon.NameBalloon;
-            SettingDialog.PostCtrlEnter = _cfgCommon.PostCtrlEnter;
-            SettingDialog.PostShiftEnter = _cfgCommon.PostShiftEnter;
 
             SettingDialog.CountApi = _cfgCommon.CountApi;
             SettingDialog.CountApiReply = _cfgCommon.CountApiReply;
@@ -808,7 +804,6 @@ namespace OpenTween
 
             SettingDialog.BrowserPath = _cfgLocal.BrowserPath;
             SettingDialog.PostAndGet = _cfgCommon.PostAndGet;
-            SettingDialog.UseRecommendStatus = _cfgLocal.UseRecommendStatus;
             SettingDialog.DispUsername = _cfgCommon.DispUsername;
             SettingDialog.CloseToExit = _cfgCommon.CloseToExit;
             SettingDialog.MinimizeToTray = _cfgCommon.MinimizeToTray;
@@ -827,7 +822,6 @@ namespace OpenTween
             //SettingDialog.UrlConvertAuto = _cfgCommon.UrlConvertAuto;
 
             SettingDialog.DefaultTimeOut = _cfgCommon.DefaultTimeOut;
-            SettingDialog.RetweetNoConfirm = _cfgCommon.RetweetNoConfirm;
             SettingDialog.PlaySound = _cfgCommon.PlaySound;
             SettingDialog.LimitBalloon = _cfgCommon.LimitBalloon;
             SettingDialog.EventNotifyEnabled = _cfgCommon.EventNotifyEnabled;
@@ -850,8 +844,6 @@ namespace OpenTween
             SettingDialog.BitlyUser = _cfgCommon.BilyUser;
             SettingDialog.BitlyPwd = _cfgCommon.BitlyPwd;
             SettingDialog.Language = _cfgCommon.Language;
-            SettingDialog.UseAtIdSupplement = _cfgCommon.UseAtIdSupplement;
-            SettingDialog.UseHashSupplement = _cfgCommon.UseHashSupplement;
             SettingDialog.PreviewEnable = _cfgCommon.PreviewEnable;
             SettingDialog.StatusAreaAtBottom = _cfgCommon.StatusAreaAtBottom;
             AtIdSupl = new AtIdSupplement(SettingAtIdList.Load().AtIdList, "@");
@@ -2165,12 +2157,12 @@ namespace OpenTween
 
             bool isCutOff = false;
             bool isRemoveFooter = MyCommon.IsKeyDown(Keys.Shift);
-            if (StatusText.Multiline && !SettingDialog.PostCtrlEnter)
+            if (StatusText.Multiline && !this._cfgCommon.PostCtrlEnter)
             {
                 //複数行でEnter投稿の場合、Ctrlも押されていたらフッタ付加しない
                 isRemoveFooter = MyCommon.IsKeyDown(Keys.Control);
             }
-            if (SettingDialog.PostShiftEnter)
+            if (this._cfgCommon.PostShiftEnter)
             {
                 isRemoveFooter = MyCommon.IsKeyDown(Keys.Control);
             }
@@ -2227,12 +2219,12 @@ namespace OpenTween
                 }
                 if (!isRemoveFooter)
                 {
-                    if (SettingDialog.UseRecommendStatus)
+                    if (this._cfgLocal.UseRecommendStatus)
                         // 推奨ステータスを使用する
                         footer += SettingDialog.RecommendStatusText;
                     else
                         // テキストボックスに入力されている文字列を使用する
-                        footer += " " + SettingDialog.Status.Trim();
+                        footer += " " + this._cfgLocal.StatusText.Trim();
                 }
             }
             args.status.status = header + StatusText.Text + footer;
@@ -4825,7 +4817,7 @@ namespace OpenTween
         {
             if (e.KeyChar == '@')
             {
-                if (!SettingDialog.UseAtIdSupplement) return;
+                if (!this._cfgCommon.UseAtIdSupplement) return;
                 //@マーク
                 int cnt = AtIdSupl.ItemCount;
                 ShowSuplDialog(StatusText, AtIdSupl);
@@ -4834,7 +4826,7 @@ namespace OpenTween
             }
             else if (e.KeyChar == '#')
             {
-                if (!SettingDialog.UseHashSupplement) return;
+                if (!this._cfgCommon.UseHashSupplement) return;
                 ShowSuplDialog(StatusText, HashSupl);
                 e.Handled = true;
             }
@@ -4959,14 +4951,14 @@ namespace OpenTween
 
             int pLen = 140 - statusText.Length;
             if (this.NotifyIcon1 == null || !this.NotifyIcon1.Visible) return pLen;
-            if ((isAuto && !MyCommon.IsKeyDown(Keys.Control) && SettingDialog.PostShiftEnter) ||
-                (isAuto && !MyCommon.IsKeyDown(Keys.Shift) && !SettingDialog.PostShiftEnter) ||
+            if ((isAuto && !MyCommon.IsKeyDown(Keys.Control) && this._cfgCommon.PostShiftEnter) ||
+                (isAuto && !MyCommon.IsKeyDown(Keys.Shift) && !this._cfgCommon.PostShiftEnter) ||
                 (!isAuto && isAddFooter))
             {
-                if (SettingDialog.UseRecommendStatus)
+                if (this._cfgLocal.UseRecommendStatus)
                     pLen -= SettingDialog.RecommendStatusText.Length;
-                else if (SettingDialog.Status.Length > 0)
-                    pLen -= SettingDialog.Status.Length + 1;
+                else if (this._cfgLocal.StatusText.Length > 0)
+                    pLen -= this._cfgLocal.StatusText.Length + 1;
             }
             if (!string.IsNullOrEmpty(HashMgr.UseHash))
             {
@@ -7710,7 +7702,7 @@ namespace OpenTween
 
         private void SaveConfigsAtId()
         {
-            if (_ignoreConfigSave || !SettingDialog.UseAtIdSupplement && AtIdSupl == null) return;
+            if (_ignoreConfigSave || !this._cfgCommon.UseAtIdSupplement && AtIdSupl == null) return;
 
             _modifySettingAtId = false;
             SettingAtIdList cfgAtId = new SettingAtIdList(AtIdSupl.GetItemList());
@@ -7734,8 +7726,6 @@ namespace OpenTween
                 _cfgCommon.PlaySound = SettingDialog.PlaySound;
 
                 _cfgCommon.NameBalloon = SettingDialog.NameBalloon;
-                _cfgCommon.PostCtrlEnter = SettingDialog.PostCtrlEnter;
-                _cfgCommon.PostShiftEnter = SettingDialog.PostShiftEnter;
                 _cfgCommon.CountApi = SettingDialog.CountApi;
                 _cfgCommon.CountApiReply = SettingDialog.CountApiReply;
                 _cfgCommon.DispUsername = SettingDialog.DispUsername;
@@ -7747,7 +7737,6 @@ namespace OpenTween
                 _cfgCommon.AlwaysTop = SettingDialog.AlwaysTop;
                 _cfgCommon.UrlConvertAuto = SettingDialog.UrlConvertAuto;
                 _cfgCommon.DefaultTimeOut = SettingDialog.DefaultTimeOut;
-                _cfgCommon.RetweetNoConfirm = SettingDialog.RetweetNoConfirm;
                 _cfgCommon.LimitBalloon = SettingDialog.LimitBalloon;
                 _cfgCommon.EventNotifyEnabled = SettingDialog.EventNotifyEnabled;
                 _cfgCommon.EventNotifyFlag = SettingDialog.EventNotifyFlag;
@@ -7769,8 +7758,6 @@ namespace OpenTween
                 _cfgCommon.ReadOldPosts = SettingDialog.ReadOldPosts;
                 _cfgCommon.BilyUser = SettingDialog.BitlyUser;
                 _cfgCommon.BitlyPwd = SettingDialog.BitlyPwd;
-                _cfgCommon.UseAtIdSupplement = SettingDialog.UseAtIdSupplement;
-                _cfgCommon.UseHashSupplement = SettingDialog.UseHashSupplement;
                 _cfgCommon.PreviewEnable = SettingDialog.PreviewEnable;
                 _cfgCommon.StatusAreaAtBottom = SettingDialog.StatusAreaAtBottom;
                 _cfgCommon.Language = SettingDialog.Language;
@@ -7859,7 +7846,6 @@ namespace OpenTween
                 _cfgLocal.PreviewDistance = _mySpDis3;
                 _cfgLocal.StatusMultiline = StatusText.Multiline;
                 _cfgLocal.StatusTextHeight = _mySpDis2;
-                _cfgLocal.StatusText = SettingDialog.Status;
 
                 _cfgLocal.FontUnread = _fntUnread;
                 _cfgLocal.ColorUnread = _clUnread;
@@ -7884,7 +7870,6 @@ namespace OpenTween
                 _cfgLocal.FontInputFont = _fntInputFont;
 
                 _cfgLocal.BrowserPath = SettingDialog.BrowserPath;
-                _cfgLocal.UseRecommendStatus = SettingDialog.UseRecommendStatus;
                 _cfgLocal.ProxyType = SettingDialog.SelectedProxyType;
                 _cfgLocal.ProxyAddress = SettingDialog.ProxyAddress;
                 _cfgLocal.ProxyPort = SettingDialog.ProxyPort;
@@ -8887,7 +8872,7 @@ namespace OpenTween
                     bool _NewLine = false;
                     bool _Post = false;
 
-                    if (SettingDialog.PostCtrlEnter) //Ctrl+Enter投稿時
+                    if (this._cfgCommon.PostCtrlEnter) //Ctrl+Enter投稿時
                     {
                         if (StatusText.Multiline)
                         {
@@ -8901,7 +8886,7 @@ namespace OpenTween
                         }
 
                     }
-                    else if (SettingDialog.PostShiftEnter) //SHift+Enter投稿時
+                    else if (this._cfgCommon.PostShiftEnter) //SHift+Enter投稿時
                     {
                         if (StatusText.Multiline)
                         {
@@ -9476,7 +9461,7 @@ namespace OpenTween
             // 本当にリプライ先指定すべきかどうかの判定
             m = Regex.Matches(StatusText, "(^|[ -/:-@[-^`{-~])(?<id>@[a-zA-Z0-9_]+)");
 
-            if (SettingDialog.UseAtIdSupplement)
+            if (this._cfgCommon.UseAtIdSupplement)
             {
                 int bCnt = AtIdSupl.ItemCount;
                 foreach (Match mid in m)
@@ -10946,7 +10931,7 @@ namespace OpenTween
                         _DoFavRetweetFlags = false;
                         return;
                     }
-                    if (!SettingDialog.RetweetNoConfirm)
+                    if (!this._cfgCommon.RetweetNoConfirm)
                     {
                         string Questiontext = Properties.Resources.RetweetQuestion1;
                         if (_DoFavRetweetFlags) Questiontext = Properties.Resources.FavoritesRetweetQuestionText2;