• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

開発に使用するリポジトリ


Commit MetaInfo

Revisiónd82ff859f775ab6d80fb4baa70f056a0b11ae8fd (tree)
Tiempo2012-12-05 20:24:53
AutorKimura Youichi <kim.upsilon@bucy...>
CommiterKimura Youichi

Log Message

TabsDialog を書き直し

Cambiar Resumen

Diferencia incremental

--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,9 @@ install:
55 # Install NUnit 2.6
66 - wget -q http://de.archive.ubuntu.com/ubuntu/pool/main/n/nunit/libnunit2.6-cil_2.6.0.12051+dfsg-2_all.deb http://de.archive.ubuntu.com/ubuntu/pool/universe/n/nunit/nunit-console_2.6.0.12051+dfsg-2_all.deb
77 - sudo dpkg -i libnunit2.6-cil_2.6.0.12051+dfsg-2_all.deb nunit-console_2.6.0.12051+dfsg-2_all.deb
8+ # Setup Xvfb
9+ - export DISPLAY=:99.0
10+ - sh -e /etc/init.d/xvfb start
811
912 # Build
1013 script:
--- a/OpenTween.Tests/OpenTween.Tests.csproj
+++ b/OpenTween.Tests/OpenTween.Tests.csproj
@@ -52,6 +52,7 @@
5252 <ItemGroup>
5353 <Compile Include="MyCommonTest.cs" />
5454 <Compile Include="Properties\AssemblyInfo.cs" />
55+ <Compile Include="TabsDialogTest.cs" />
5556 </ItemGroup>
5657 <ItemGroup>
5758 <ProjectReference Include="..\OpenTween\OpenTween.csproj">
--- /dev/null
+++ b/OpenTween.Tests/TabsDialogTest.cs
@@ -0,0 +1,143 @@
1+// OpenTween - Client of Twitter
2+// Copyright (c) 2012 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3+// All rights reserved.
4+//
5+// This file is part of OpenTween.
6+//
7+// This program is free software; you can redistribute it and/or modify it
8+// under the terms of the GNU General Public License as published by the Free
9+// Software Foundation; either version 3 of the License, or (at your option)
10+// any later version.
11+//
12+// This program is distributed in the hope that it will be useful, but
13+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+// for more details.
16+//
17+// You should have received a copy of the GNU General Public License along
18+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19+// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20+// Boston, MA 02110-1301, USA.
21+
22+using System;
23+using System.Collections.Generic;
24+using System.Linq;
25+using System.Text;
26+using NUnit.Framework;
27+using System.Windows.Forms;
28+using System.Reflection;
29+
30+namespace OpenTween
31+{
32+ class TabsDialogTest
33+ {
34+ private TabInformations tabinfo;
35+
36+ [SetUp]
37+ public void TabInformationSetUp()
38+ {
39+ this.tabinfo = Activator.CreateInstance(typeof(TabInformations), true) as TabInformations;
40+
41+ // タブを追加
42+ this.tabinfo.AddTab("Recent", MyCommon.TabUsageType.Home, null);
43+ this.tabinfo.AddTab("Reply", MyCommon.TabUsageType.Mentions, null);
44+ this.tabinfo.AddTab("DM", MyCommon.TabUsageType.DirectMessage, null);
45+ this.tabinfo.AddTab("Favorites", MyCommon.TabUsageType.Favorites, null);
46+ this.tabinfo.AddTab("MyTab1", MyCommon.TabUsageType.UserDefined, null);
47+
48+ // 一応 TabInformation.GetInstance() でも取得できるようにする
49+ var field = typeof(TabInformations).GetField("_instance",
50+ BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.SetField);
51+ field.SetValue(null, this.tabinfo);
52+ }
53+
54+ [Test]
55+ public void OKButtonEnabledTest()
56+ {
57+ using (var dialog = new TabsDialog(this.tabinfo))
58+ {
59+ Assert.That(dialog.OK_Button.Enabled, Is.False);
60+
61+ dialog.TabList.SelectedIndex = 0;
62+
63+ Assert.That(dialog.OK_Button.Enabled, Is.True);
64+ }
65+ }
66+
67+ [Test]
68+ public void MultiSelectTest()
69+ {
70+ using (var dialog = new TabsDialog(this.tabinfo))
71+ {
72+ // MultiSelect = false (default)
73+ var firstItem = dialog.TabList.Items[0] as TabsDialog.TabListItem;
74+ Assert.That(firstItem.Tab, Is.Null); // 「(新規タブ)」
75+ Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.One));
76+
77+ dialog.MultiSelect = true;
78+ firstItem = dialog.TabList.Items[0] as TabsDialog.TabListItem;
79+ Assert.That(firstItem.Tab, Is.Not.Null);
80+ Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.MultiExtended));
81+
82+ dialog.MultiSelect = false;
83+ firstItem = dialog.TabList.Items[0] as TabsDialog.TabListItem;
84+ Assert.That(firstItem.Tab, Is.Null);
85+ Assert.That(dialog.TabList.SelectionMode, Is.EqualTo(SelectionMode.One));
86+ }
87+ }
88+
89+ [Test]
90+ public void SelectableTabTest()
91+ {
92+ using (var dialog = new TabsDialog(this.tabinfo))
93+ {
94+ dialog.MultiSelect = false;
95+
96+ var item = dialog.TabList.Items[0] as TabsDialog.TabListItem;
97+ Assert.That(item.Tab, Is.Null);
98+
99+ item = dialog.TabList.Items[1] as TabsDialog.TabListItem;
100+ Assert.That(item.Tab, Is.EqualTo(this.tabinfo.Tabs["Reply"]));
101+
102+ item = dialog.TabList.Items[2] as TabsDialog.TabListItem;
103+ Assert.That(item.Tab, Is.EqualTo(this.tabinfo.Tabs["MyTab1"]));
104+ }
105+ }
106+
107+ [Test]
108+ public void SelectedTabTest()
109+ {
110+ using (var dialog = new TabsDialog(this.tabinfo))
111+ {
112+ dialog.MultiSelect = false;
113+
114+ dialog.TabList.SelectedIndex = 0;
115+ Assert.That(dialog.SelectedTab, Is.Null);
116+
117+ dialog.TabList.SelectedIndex = 1;
118+ Assert.That(dialog.SelectedTab, Is.EqualTo(this.tabinfo.Tabs["Reply"]));
119+ }
120+ }
121+
122+ [Test]
123+ public void SelectedTabsTest()
124+ {
125+ using (var dialog = new TabsDialog(this.tabinfo))
126+ {
127+ dialog.MultiSelect = true;
128+
129+ dialog.TabList.SelectedIndices.Clear();
130+ var selectedTabs = dialog.SelectedTabs;
131+ Assert.That(selectedTabs, Is.Empty);
132+
133+ dialog.TabList.SelectedIndices.Add(0);
134+ selectedTabs = dialog.SelectedTabs;
135+ Assert.That(selectedTabs, Is.EquivalentTo(new[] { this.tabinfo.Tabs["Reply"] }));
136+
137+ dialog.TabList.SelectedIndices.Add(1);
138+ selectedTabs = dialog.SelectedTabs;
139+ Assert.That(selectedTabs, Is.EquivalentTo(new[] { this.tabinfo.Tabs["Reply"], this.tabinfo.Tabs["MyTab1"] }));
140+ }
141+ }
142+ }
143+}
--- a/OpenTween/FilterDialog.cs
+++ b/OpenTween/FilterDialog.cs
@@ -47,8 +47,6 @@ namespace OpenTween
4747 private string _cur;
4848 private List<string> idlist = new List<string>();
4949
50- private TabsDialog tabdialog = new TabsDialog(true);
51-
5250 private enum EDITMODE
5351 {
5452 AddNew,
@@ -878,7 +876,6 @@ namespace OpenTween
878876 {
879877 ListTabs.Items.Add(key);
880878 }
881- SetTabnamesToDialog();
882879
883880 ComboSound.Items.Clear();
884881 ComboSound.Items.Add("");
@@ -921,15 +918,6 @@ namespace OpenTween
921918 }
922919 }
923920
924- private void SetTabnamesToDialog()
925- {
926- tabdialog.ClearTab();
927- foreach (string key in _sts.Tabs.Keys)
928- {
929- if (TabInformations.GetInstance().IsDistributableTab(key)) tabdialog.AddTab(key);
930- }
931- }
932-
933921 private void ListTabs_SelectedIndexChanged(object sender, EventArgs e)
934922 {
935923 if (ListTabs.SelectedIndex > -1)
@@ -979,7 +967,6 @@ namespace OpenTween
979967 {
980968 //成功
981969 ListTabs.Items.Add(tabName);
982- SetTabnamesToDialog();
983970 }
984971 }
985972 }
@@ -996,7 +983,6 @@ namespace OpenTween
996983 idx -= 1;
997984 if (idx < 0) idx = 0;
998985 ListTabs.SelectedIndex = idx;
999- SetTabnamesToDialog();
1000986 }
1001987 }
1002988 }
@@ -1012,7 +998,6 @@ namespace OpenTween
1012998 ListTabs.Items.RemoveAt(idx);
1013999 ListTabs.Items.Insert(idx, tb);
10141000 ListTabs.SelectedIndex = idx;
1015- SetTabnamesToDialog();
10161001 }
10171002 }
10181003 }
@@ -1133,28 +1118,32 @@ namespace OpenTween
11331118 {
11341119 if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
11351120 {
1136- tabdialog.Text = Properties.Resources.ButtonRuleCopy_ClickText1;
1137- if (tabdialog.ShowDialog() == DialogResult.Cancel)
1121+ TabClass[] selectedTabs;
1122+ using (TabsDialog dialog = new TabsDialog(_sts))
11381123 {
1139- return;
1124+ dialog.MultiSelect = true;
1125+ dialog.Text = Properties.Resources.ButtonRuleCopy_ClickText1;
1126+
1127+ if (dialog.ShowDialog(this) == DialogResult.Cancel) return;
1128+
1129+ selectedTabs = dialog.SelectedTabs;
11401130 }
1131+
11411132 string tabname = ListTabs.SelectedItem.ToString();
1142- StringCollection tabs = tabdialog.SelectedTabNames;
11431133 List<FiltersClass> filters = new List<FiltersClass>();
11441134
11451135 foreach (int idx in ListFilters.SelectedIndices)
11461136 {
11471137 filters.Add(_sts.Tabs[tabname].Filters[idx].CopyTo(new FiltersClass()));
11481138 }
1149- foreach (string tb in tabs)
1139+ foreach (var tb in selectedTabs)
11501140 {
1151- if (tb != tabname)
1141+ if (tb.TabName == tabname) continue;
1142+
1143+ foreach (FiltersClass flt in filters)
11521144 {
1153- foreach (FiltersClass flt in filters)
1154- {
1155- if (!_sts.Tabs[tb].Filters.Contains(flt))
1156- _sts.Tabs[tb].AddFilter(flt.CopyTo(new FiltersClass()));
1157- }
1145+ if (!tb.Filters.Contains(flt))
1146+ tb.AddFilter(flt.CopyTo(new FiltersClass()));
11581147 }
11591148 }
11601149 SetFilters(tabname);
@@ -1165,29 +1154,32 @@ namespace OpenTween
11651154 {
11661155 if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
11671156 {
1168- tabdialog.Text = Properties.Resources.ButtonRuleMove_ClickText1;
1169- if (tabdialog.ShowDialog() == DialogResult.Cancel)
1157+ TabClass[] selectedTabs;
1158+ using (var dialog = new TabsDialog(_sts))
11701159 {
1171- return;
1160+ dialog.MultiSelect = true;
1161+ dialog.Text = Properties.Resources.ButtonRuleMove_ClickText1;
1162+
1163+ if (dialog.ShowDialog(this) == DialogResult.Cancel) return;
1164+
1165+ selectedTabs = dialog.SelectedTabs;
11721166 }
11731167 string tabname = ListTabs.SelectedItem.ToString();
1174- StringCollection tabs = tabdialog.SelectedTabNames;
11751168 List<FiltersClass> filters = new List<FiltersClass>();
11761169
11771170 foreach (int idx in ListFilters.SelectedIndices)
11781171 {
11791172 filters.Add(_sts.Tabs[tabname].Filters[idx].CopyTo(new FiltersClass()));
11801173 }
1181- if (tabs.Count == 1 && tabs[0] == tabname) return;
1182- foreach (string tb in tabs)
1174+ if (selectedTabs.Length == 1 && selectedTabs[0].TabName == tabname) return;
1175+ foreach (var tb in selectedTabs)
11831176 {
1184- if (tb != tabname)
1177+ if (tb.TabName == tabname) continue;
1178+
1179+ foreach (FiltersClass flt in filters)
11851180 {
1186- foreach (FiltersClass flt in filters)
1187- {
1188- if (!_sts.Tabs[tb].Filters.Contains(flt))
1189- _sts.Tabs[tb].AddFilter(flt.CopyTo(new FiltersClass()));
1190- }
1181+ if (!tb.Filters.Contains(flt))
1182+ tb.AddFilter(flt.CopyTo(new FiltersClass()));
11911183 }
11921184 }
11931185 for (int idx = ListFilters.Items.Count - 1; idx >= 0; idx--)
--- a/OpenTween/OpenTween.csproj
+++ b/OpenTween/OpenTween.csproj
@@ -130,6 +130,12 @@
130130 <Compile Include="OTWebClient.cs">
131131 <SubType>Component</SubType>
132132 </Compile>
133+ <Compile Include="TabsDialog.cs">
134+ <SubType>Form</SubType>
135+ </Compile>
136+ <Compile Include="TabsDialog.Designer.cs">
137+ <DependentUpon>TabsDialog.cs</DependentUpon>
138+ </Compile>
133139 <Compile Include="Thumbnail\Services\Foursquare.cs" />
134140 <Compile Include="Thumbnail\Services\ImgAzyobuziNet.cs" />
135141 <Compile Include="Thumbnail\Services\IThumbnailService.cs" />
@@ -216,12 +222,6 @@
216222 <Compile Include="Setting\SettingTabs.cs" />
217223 <Compile Include="Setting\SettingLocal.cs" />
218224 <Compile Include="ShortUrl.cs" />
219- <Compile Include="TabsDialog.cs">
220- <SubType>Form</SubType>
221- </Compile>
222- <Compile Include="TabsDialog.Designer.cs">
223- <DependentUpon>TabsDialog.cs</DependentUpon>
224- </Compile>
225225 <Compile Include="ShowUserInfo.cs">
226226 <SubType>Form</SubType>
227227 </Compile>
@@ -318,6 +318,15 @@
318318 <EmbeddedResource Include="AppendSettingDialog.zh-CHS.resx">
319319 <DependentUpon>AppendSettingDialog.cs</DependentUpon>
320320 </EmbeddedResource>
321+ <EmbeddedResource Include="TabsDialog.en.resx">
322+ <DependentUpon>TabsDialog.cs</DependentUpon>
323+ </EmbeddedResource>
324+ <EmbeddedResource Include="TabsDialog.resx">
325+ <DependentUpon>TabsDialog.cs</DependentUpon>
326+ </EmbeddedResource>
327+ <EmbeddedResource Include="TabsDialog.zh-CHS.resx">
328+ <DependentUpon>TabsDialog.cs</DependentUpon>
329+ </EmbeddedResource>
321330 <EmbeddedResource Include="TweetThumbnail.resx">
322331 <DependentUpon>TweetThumbnail.cs</DependentUpon>
323332 </EmbeddedResource>
@@ -380,9 +389,6 @@
380389 <EmbeddedResource Include="SearchWord.zh-CHS.resx">
381390 <DependentUpon>SearchWord.cs</DependentUpon>
382391 </EmbeddedResource>
383- <EmbeddedResource Include="TabsDialog.resx">
384- <DependentUpon>TabsDialog.cs</DependentUpon>
385- </EmbeddedResource>
386392 <EmbeddedResource Include="ShowUserInfo.en.resx">
387393 <DependentUpon>ShowUserInfo.cs</DependentUpon>
388394 </EmbeddedResource>
--- a/OpenTween/TabsDialog.Designer.cs
+++ b/OpenTween/TabsDialog.Designer.cs
@@ -29,20 +29,11 @@
2929 private void InitializeComponent()
3030 {
3131 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TabsDialog));
32- this.TableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
3332 this.OK_Button = new System.Windows.Forms.Button();
3433 this.Cancel_Button = new System.Windows.Forms.Button();
3534 this.TabList = new System.Windows.Forms.ListBox();
36- this.TableLayoutPanel1.SuspendLayout();
3735 this.SuspendLayout();
3836 //
39- // TableLayoutPanel1
40- //
41- resources.ApplyResources(this.TableLayoutPanel1, "TableLayoutPanel1");
42- this.TableLayoutPanel1.Controls.Add(this.OK_Button, 0, 0);
43- this.TableLayoutPanel1.Controls.Add(this.Cancel_Button, 1, 0);
44- this.TableLayoutPanel1.Name = "TableLayoutPanel1";
45- //
4637 // OK_Button
4738 //
4839 resources.ApplyResources(this.OK_Button, "OK_Button");
@@ -57,11 +48,11 @@
5748 //
5849 // TabList
5950 //
60- this.TabList.FormattingEnabled = true;
6151 resources.ApplyResources(this.TabList, "TabList");
62- this.TabList.Items.AddRange(new object[] {
63- resources.GetString("TabList.Items")});
52+ this.TabList.FormattingEnabled = true;
6453 this.TabList.Name = "TabList";
54+ this.TabList.SelectedValueChanged += new System.EventHandler(this.TabList_SelectedValueChanged);
55+ this.TabList.DoubleClick += new System.EventHandler(this.TabList_DoubleClick);
6556 //
6657 // TabsDialog
6758 //
@@ -69,24 +60,23 @@
6960 resources.ApplyResources(this, "$this");
7061 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
7162 this.CancelButton = this.Cancel_Button;
72- this.Controls.Add(this.TableLayoutPanel1);
63+ this.Controls.Add(this.Cancel_Button);
64+ this.Controls.Add(this.OK_Button);
7365 this.Controls.Add(this.TabList);
7466 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
7567 this.MaximizeBox = false;
7668 this.MinimizeBox = false;
7769 this.Name = "TabsDialog";
7870 this.ShowInTaskbar = false;
79- this.TopMost = true;
80- this.TableLayoutPanel1.ResumeLayout(false);
8171 this.ResumeLayout(false);
8272
8373 }
8474
8575 #endregion
8676
87- internal System.Windows.Forms.TableLayoutPanel TableLayoutPanel1;
8877 internal System.Windows.Forms.Button OK_Button;
8978 internal System.Windows.Forms.Button Cancel_Button;
9079 internal System.Windows.Forms.ListBox TabList;
80+
9181 }
9282 }
\ No newline at end of file
--- a/OpenTween/TabsDialog.cs
+++ b/OpenTween/TabsDialog.cs
@@ -1,24 +1,19 @@
11 // 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/>
2+// Copyright (c) 2012 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
83 // All rights reserved.
9-//
4+//
105 // This file is part of OpenTween.
11-//
6+//
127 // This program is free software; you can redistribute it and/or modify it
138 // under the terms of the GNU General Public License as published by the Free
149 // Software Foundation; either version 3 of the License, or (at your option)
1510 // any later version.
16-//
11+//
1712 // This program is distributed in the hope that it will be useful, but
1813 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1914 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20-// for more details.
21-//
15+// for more details.
16+//
2217 // You should have received a copy of the GNU General Public License along
2318 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
2419 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
@@ -32,157 +27,106 @@ using System.Drawing;
3227 using System.Linq;
3328 using System.Text;
3429 using System.Windows.Forms;
35-using System.Collections.Specialized;
3630
3731 namespace OpenTween
3832 {
3933 public partial class TabsDialog : Form
4034 {
41- private bool _multiSelect = false;
42- private string _newtabItem = Properties.Resources.AddNewTabText1;
35+ private readonly TabInformations TabInfo;
4336
44- public TabsDialog()
37+ private bool _MultiSelect = false;
38+ public bool MultiSelect
4539 {
46- InitializeComponent();
40+ get { return this._MultiSelect; }
41+ set { this._MultiSelect = value; this.UpdateTabList(); }
4742 }
4843
49- public TabsDialog(bool multiselect)
44+ protected internal class TabListItem
5045 {
51- // この呼び出しはデザイナーで必要です。
52- InitializeComponent();
53-
54- // InitializeComponent() 呼び出しの後で初期化を追加します。
55-
56- this.MultiSelect = true;
57-
58- }
46+ public TabClass Tab { get; set; }
47+ public string Label { get; set; }
5948
60- private void TabsDialog_Load(object sender, EventArgs e)
61- {
62- if (_multiSelect)
63- {
64- TabList.SelectedIndex = -1;
65- }
66- else
49+ public override string ToString()
6750 {
68- if (TabList.SelectedIndex == -1) TabList.SelectedIndex = 0;
51+ return this.Label;
6952 }
7053 }
7154
72- public void AddTab(string tabName)
55+ public TabsDialog(TabInformations tabinformation)
7356 {
74- foreach (string obj in TabList.Items)
75- {
76- if (obj == tabName) return;
77- }
78- TabList.Items.Add(tabName);
79- }
57+ InitializeComponent();
8058
81- public void RemoveTab(string tabName)
82- {
83- for (int i = 0; i < TabList.Items.Count; i++)
84- {
85- if (((string)TabList.Items[i]) == tabName)
86- {
87- TabList.Items.RemoveAt(i);
88- return;
89- }
90- }
59+ this.TabInfo = tabinformation;
60+ UpdateTabList();
9161 }
9262
93- public void ClearTab()
63+ protected void UpdateTabList()
9464 {
95- int startidx = 1;
65+ this.TabList.Items.Clear();
9666
97- if (_multiSelect)
67+ if (this.MultiSelect)
9868 {
99- startidx = 0;
69+ this.TabList.SelectionMode = SelectionMode.MultiExtended;
10070 }
101- for (int i = startidx; i < TabList.Items.Count; i++)
71+ else
10272 {
103- TabList.Items.RemoveAt(0);
104- }
105- }
73+ this.TabList.SelectionMode = SelectionMode.One;
10674
107- public string SelectedTabName
108- {
109- get
110- {
111- if (TabList.SelectedIndex == -1)
112- return "";
113- else
114- return (string)TabList.SelectedItem;
75+ this.TabList.Items.Add(new TabListItem
76+ {
77+ Label = Properties.Resources.AddNewTabText1,
78+ Tab = null,
79+ });
11580 }
116- }
11781
118- public StringCollection SelectedTabNames
119- {
120- get
82+ foreach (var tab in this.TabInfo.Tabs)
12183 {
122- if (TabList.SelectedIndex == -1)
123- {
124- return null;
125- }
126- else
84+ if (!this.TabInfo.IsDistributableTab(tab.Key)) continue;
85+
86+ this.TabList.Items.Add(new TabListItem
12787 {
128- StringCollection ret = new StringCollection();
129- foreach (object selitem in TabList.SelectedItems)
130- {
131- ret.Add((string)selitem);
132- }
133- return ret;
134- }
88+ Label = tab.Key,
89+ Tab = tab.Value,
90+ });
13591 }
13692 }
13793
138- public bool MultiSelect
94+ private void TabList_DoubleClick(object sender, EventArgs e)
13995 {
140- get { return _multiSelect; }
141- set
142- {
143- _multiSelect = value;
144- if (value)
145- {
146- this.TabList.SelectionMode = SelectionMode.MultiExtended;
147- if (this.TabList.Items[0].ToString() == Properties.Resources.AddNewTabText1)
148- {
149- this.TabList.Items.RemoveAt(0);
150- }
151- }
152- else
153- {
154- this.TabList.SelectionMode = SelectionMode.One;
155- if (this.TabList.Items[0].ToString() != Properties.Resources.AddNewTabText1)
156- {
157- this.TabList.Items.Insert(0, Properties.Resources.AddNewTabText1);
158- }
159- }
160- }
96+ if (this.TabList.SelectedIndex == -1) return;
97+
98+ this.DialogResult = DialogResult.OK;
99+ this.Close();
161100 }
162101
163- private void TabList_SelectedIndexChanged(object sender, EventArgs e)
102+ private void TabList_SelectedValueChanged(object sender, EventArgs e)
164103 {
104+ if (this.TabList.SelectedIndex == -1)
105+ this.OK_Button.Enabled = false;
106+ else
107+ this.OK_Button.Enabled = true;
165108 }
166109
167- private void TabList_DoubleClick(object sender, EventArgs e)
110+ public TabClass SelectedTab
168111 {
169- if (TabList.SelectedItem == null)
112+ get
170113 {
171- return;
172- }
114+ var item = this.TabList.SelectedItem as TabListItem;
115+ if (item == null) return null;
173116
174- if (TabList.IndexFromPoint(TabList.PointToClient(Control.MousePosition)) == ListBox.NoMatches)
175- {
176- return;
117+ return item.Tab;
177118 }
178-
179- this.DialogResult = DialogResult.OK;
180- this.Close();
181119 }
182120
183- private void TabsDialog_Shown(object sender, EventArgs e)
121+ public TabClass[] SelectedTabs
184122 {
185- TabList.Focus();
123+ get
124+ {
125+ return this.TabList.SelectedItems
126+ .Cast<TabListItem>()
127+ .Select(x => x.Tab)
128+ .ToArray();
129+ }
186130 }
187131 }
188132 }
--- a/OpenTween/TabsDialog.resx
+++ b/OpenTween/TabsDialog.resx
@@ -118,22 +118,22 @@
118118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119 </resheader>
120120 <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
121- <data name="TableLayoutPanel1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
121+ <data name="OK_Button.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
122122 <value>Bottom, Right</value>
123123 </data>
124124 <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
125- <data name="TableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
126- <value>2</value>
127- </data>
128- <data name="OK_Button.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
129- <value>None</value>
125+ <data name="OK_Button.Enabled" type="System.Boolean, mscorlib">
126+ <value>False</value>
130127 </data>
131128 <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
132129 <data name="OK_Button.Location" type="System.Drawing.Point, System.Drawing">
133- <value>3, 3</value>
130+ <value>13, 130</value>
131+ </data>
132+ <data name="OK_Button.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
133+ <value>4, 4, 4, 4</value>
134134 </data>
135135 <data name="OK_Button.Size" type="System.Drawing.Size, System.Drawing">
136- <value>67, 21</value>
136+ <value>89, 26</value>
137137 </data>
138138 <data name="OK_Button.TabIndex" type="System.Int32, mscorlib">
139139 <value>0</value>
@@ -148,19 +148,22 @@
148148 <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
149149 </data>
150150 <data name="&gt;&gt;OK_Button.Parent" xml:space="preserve">
151- <value>TableLayoutPanel1</value>
151+ <value>$this</value>
152152 </data>
153153 <data name="&gt;&gt;OK_Button.ZOrder" xml:space="preserve">
154- <value>0</value>
154+ <value>1</value>
155155 </data>
156156 <data name="Cancel_Button.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
157- <value>None</value>
157+ <value>Bottom, Right</value>
158158 </data>
159159 <data name="Cancel_Button.Location" type="System.Drawing.Point, System.Drawing">
160- <value>76, 3</value>
160+ <value>110, 130</value>
161+ </data>
162+ <data name="Cancel_Button.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
163+ <value>4, 4, 4, 4</value>
161164 </data>
162165 <data name="Cancel_Button.Size" type="System.Drawing.Size, System.Drawing">
163- <value>67, 21</value>
166+ <value>89, 26</value>
164167 </data>
165168 <data name="Cancel_Button.TabIndex" type="System.Int32, mscorlib">
166169 <value>1</value>
@@ -175,49 +178,25 @@
175178 <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
176179 </data>
177180 <data name="&gt;&gt;Cancel_Button.Parent" xml:space="preserve">
178- <value>TableLayoutPanel1</value>
179- </data>
180- <data name="&gt;&gt;Cancel_Button.ZOrder" xml:space="preserve">
181- <value>1</value>
182- </data>
183- <data name="TableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
184- <value>11, 111</value>
185- </data>
186- <data name="TableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
187- <value>1</value>
188- </data>
189- <data name="TableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
190- <value>146, 27</value>
191- </data>
192- <data name="TableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
193- <value>1</value>
194- </data>
195- <data name="&gt;&gt;TableLayoutPanel1.Name" xml:space="preserve">
196- <value>TableLayoutPanel1</value>
197- </data>
198- <data name="&gt;&gt;TableLayoutPanel1.Type" xml:space="preserve">
199- <value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
200- </data>
201- <data name="&gt;&gt;TableLayoutPanel1.Parent" xml:space="preserve">
202181 <value>$this</value>
203182 </data>
204- <data name="&gt;&gt;TableLayoutPanel1.ZOrder" xml:space="preserve">
183+ <data name="&gt;&gt;Cancel_Button.ZOrder" xml:space="preserve">
205184 <value>0</value>
206185 </data>
207- <data name="TableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
208- <value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="OK_Button" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="Cancel_Button" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,50,Percent,50" /&gt;&lt;Rows Styles="Percent,50" /&gt;&lt;/TableLayoutSettings&gt;</value>
186+ <data name="TabList.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
187+ <value>Top, Bottom, Left, Right</value>
209188 </data>
210189 <data name="TabList.ItemHeight" type="System.Int32, mscorlib">
211- <value>12</value>
212- </data>
213- <data name="TabList.Items" xml:space="preserve">
214- <value>(新規タブ)</value>
190+ <value>15</value>
215191 </data>
216192 <data name="TabList.Location" type="System.Drawing.Point, System.Drawing">
217- <value>14, 12</value>
193+ <value>13, 13</value>
194+ </data>
195+ <data name="TabList.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
196+ <value>4, 4, 4, 4</value>
218197 </data>
219198 <data name="TabList.Size" type="System.Drawing.Size, System.Drawing">
220- <value>140, 88</value>
199+ <value>186, 109</value>
221200 </data>
222201 <data name="TabList.TabIndex" type="System.Int32, mscorlib">
223202 <value>0</value>
@@ -232,16 +211,22 @@
232211 <value>$this</value>
233212 </data>
234213 <data name="&gt;&gt;TabList.ZOrder" xml:space="preserve">
235- <value>1</value>
214+ <value>2</value>
236215 </data>
237216 <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
238217 <value>True</value>
239218 </metadata>
240219 <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
241- <value>6, 12</value>
220+ <value>8, 15</value>
242221 </data>
243222 <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
244- <value>169, 149</value>
223+ <value>212, 169</value>
224+ </data>
225+ <data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
226+ <value>NoControl</value>
227+ </data>
228+ <data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
229+ <value>4, 4, 4, 4</value>
245230 </data>
246231 <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
247232 <value>CenterParent</value>
--- a/OpenTween/Tween.cs
+++ b/OpenTween/Tween.cs
@@ -103,7 +103,6 @@ namespace OpenTween
103103
104104 //サブ画面インスタンス
105105 private AppendSettingDialog SettingDialog = AppendSettingDialog.Instance; //設定画面インスタンス
106- private TabsDialog TabDialog = new TabsDialog(); //タブ選択ダイアログインスタンス
107106 private SearchWord SearchDialog = new SearchWord(); //検索画面インスタンス
108107 private FilterDialog fltDialog = new FilterDialog(); //フィルター編集画面
109108 private OpenURL UrlDialog = new OpenURL();
@@ -343,7 +342,6 @@ namespace OpenTween
343342 {
344343 //後始末
345344 SettingDialog.Dispose();
346- TabDialog.Dispose();
347345 SearchDialog.Dispose();
348346 fltDialog.Dispose();
349347 UrlDialog.Dispose();
@@ -578,7 +576,6 @@ namespace OpenTween
578576 SettingDialog.Owner = this;;
579577 SearchDialog.Owner = this;
580578 fltDialog.Owner = this;
581- TabDialog.Owner = this;
582579 UrlDialog.Owner = this;
583580
584581 _history.Add(new PostingStatus());
@@ -4599,8 +4596,6 @@ namespace OpenTween
45994596 _colHd8.Text = ColumnText[7];
46004597 _colHd8.Width = 50;
46014598
4602- if (_statuses.IsDistributableTab(tabName)) TabDialog.AddTab(tabName);
4603-
46044599 _listCustom.SmallImageList = new ImageList();
46054600 if (_iconSz > 0)
46064601 {
@@ -4770,8 +4765,6 @@ namespace OpenTween
47704765 _listCustom.DrawSubItem -= MyList_DrawSubItem;
47714766 _listCustom.HScrolled -= MyList_HScrolled;
47724767
4773- TabDialog.RemoveTab(TabName);
4774-
47754768 _listCustom.SmallImageList = null;
47764769 _listCustom.ListViewItemSorter = null;
47774770
@@ -8037,10 +8030,6 @@ namespace OpenTween
80378030 //タブ名のリスト作り直し(デフォルトタブ以外は再作成)
80388031 for (int i = 0; i < ListTab.TabCount; i++)
80398032 {
8040- if (_statuses.IsDistributableTab(ListTab.TabPages[i].Text))
8041- {
8042- TabDialog.RemoveTab(ListTab.TabPages[i].Text);
8043- }
80448033 if (ListTab.TabPages[i].Text == tabName)
80458034 {
80468035 ListTab.TabPages[i].Text = newTabText;
@@ -8056,7 +8045,6 @@ namespace OpenTween
80568045 {
80578046 ListTab.TabPages[i].Text = newTabText;
80588047 }
8059- TabDialog.AddTab(ListTab.TabPages[i].Text);
80608048 }
80618049 }
80628050 SaveConfigsCommon();
@@ -8869,9 +8857,9 @@ namespace OpenTween
88698857 //選択発言を元にフィルタ追加
88708858 foreach (int idx in _curList.SelectedIndices)
88718859 {
8872- string tabName = "";
8860+ string tabName;
88738861 //タブ選択(or追加)
8874- if (!SelectTab(ref tabName)) return;
8862+ if (!SelectTab(out tabName)) return;
88758863
88768864 fltDialog.SetCurrent(tabName);
88778865 if (_statuses[_curTab.Text, idx].RetweetedId == 0)
@@ -9013,13 +9001,13 @@ namespace OpenTween
90139001
90149002 private void IDRuleMenuItem_Click(object sender, EventArgs e)
90159003 {
9016- string tabName = "";
9004+ string tabName;
90179005
90189006 //未選択なら処理終了
90199007 if (_curList.SelectedIndices.Count == 0) return;
90209008
90219009 //タブ選択(or追加)
9022- if (!SelectTab(ref tabName)) return;
9010+ if (!SelectTab(out tabName)) return;
90239011
90249012 bool mv = false;
90259013 bool mk = false;
@@ -9095,22 +9083,24 @@ namespace OpenTween
90959083 SaveConfigsTabs();
90969084 }
90979085
9098- private bool SelectTab(ref string tabName)
9086+ private bool SelectTab(out string tabName)
90999087 {
91009088 do
91019089 {
9090+ tabName = null;
9091+
91029092 //振り分け先タブ選択
9103- if (TabDialog.ShowDialog() == DialogResult.Cancel || string.IsNullOrEmpty(this.TabDialog.SelectedTabName))
9093+ using (var dialog = new TabsDialog(_statuses))
91049094 {
9105- this.TopMost = SettingDialog.AlwaysTop;
9106- return false;
9095+ if (dialog.ShowDialog(this) == DialogResult.Cancel) return false;
9096+
9097+ var selectedTab = dialog.SelectedTab;
9098+ tabName = selectedTab == null ? null : selectedTab.TabName;
91079099 }
9108- this.TopMost = SettingDialog.AlwaysTop;
9109- tabName = TabDialog.SelectedTabName;
91109100
91119101 ListTab.SelectedTab.Focus();
91129102 //新規タブを選択→タブ作成
9113- if (tabName == Properties.Resources.IDRuleMenuItem_ClickText1)
9103+ if (tabName == null)
91149104 {
91159105 using (InputTabName inputName = new InputTabName())
91169106 {
@@ -11545,13 +11535,13 @@ namespace OpenTween
1154511535 string name = GetUserId();
1154611536 if (name != null)
1154711537 {
11548- string tabName = "";
11538+ string tabName;
1154911539
1155011540 //未選択なら処理終了
1155111541 if (_curList.SelectedIndices.Count == 0) return;
1155211542
1155311543 //タブ選択(or追加)
11554- if (!SelectTab(ref tabName)) return;
11544+ if (!SelectTab(out tabName)) return;
1155511545
1155611546 bool mv = false;
1155711547 bool mk = false;