• R/O
  • SSH
  • HTTPS

scfiler: Commit


Commit MetaInfo

Revision89 (tree)
Time2009-05-16 19:46:55
Authoryuki_sc

Log Message

サムネイル表示対応

Change Summary

Incremental Difference

--- SCFiler2/OptionDialog.cs (revision 88)
+++ SCFiler2/OptionDialog.cs (revision 89)
@@ -58,6 +58,14 @@
5858 } else {
5959 system.Option.FileView.IconDisplay = SCFiler2System.OptionClass.FileViewOption.FileIconDisp.Nothing;
6060 }
61+ try {
62+ system.Option.FileView.ThumbnailWidth = Math.Min(Math.Max(80, int.Parse(this.ThumbnailWidthTextbox.Text)), 300);
63+ system.Option.FileView.ThumbnailHeight = Math.Min(Math.Max(80, int.Parse(this.ThumbnailHeightTextbox.Text)), 300);
64+ } catch {
65+ //変換に失敗したらデフォルト値に戻す
66+ system.Option.FileView.ThumbnailWidth = 120;
67+ system.Option.FileView.ThumbnailHeight = 120;
68+ }
6169
6270 //■色タブ
6371 system.Option.Color.ActiveViewTitleText = colorActiveViewTitle.ForegroundColor;
@@ -177,6 +185,8 @@
177185 this.FileIconAllDisplayRadioBUtton.Checked = true;
178186 break;
179187 }
188+ this.ThumbnailWidthTextbox.Text = system.Option.FileView.ThumbnailWidth.ToString();
189+ this.ThumbnailHeightTextbox.Text = system.Option.FileView.ThumbnailHeight.ToString();
180190
181191 //■履歴タブ
182192 historyview1ValidExtensionsString.Text = MainForm.Instance.FileHistoryManager1.GetValidExtension();
--- SCFiler2/ThumbnailMode.cs (nonexistent)
+++ SCFiler2/ThumbnailMode.cs (revision 89)
@@ -0,0 +1,36 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Text;
4+using SCFiler2.ViewInterface;
5+
6+namespace SCFiler2.Operation {
7+ public class ThumbnailMode : Action {
8+ public override string DisplayString {
9+ get { return "サムネイル表示"; }
10+ }
11+
12+ public override ActionType Type {
13+ get { return ActionType.View; }
14+ }
15+
16+ public override void Execute() {
17+ if (ViewInterfaces.CurrentItemView.Type != ViewType.FileView) {
18+ SCFiler2System.ShowTempMessage(Messages.COMMAND_IS_NOT_VALID_IN_THIS_VIEW);
19+ return;
20+ }
21+
22+ IFileView view = ViewInterfaces.LastFocusedFileView;
23+ if (view.CurrentPath == "") {
24+ SCFiler2System.ShowTempMessage(Messages.COMMAND_IS_NOT_VALID_FOR_DRIVE_CATALOGUE);
25+ return;
26+ }
27+
28+ if (view.ViewMode != ViewMode.ThumbnailMode) {
29+ view.ViewMode = ViewMode.ThumbnailMode;
30+ } else {
31+ //すでにサムネイル表示中だったら元に戻す
32+ view.ViewMode = ViewMode.Normal;
33+ }
34+ }
35+ }
36+}
--- SCFiler2/FileView.cs (revision 88)
+++ SCFiler2/FileView.cs (revision 89)
@@ -16,8 +16,8 @@
1616 using SCFiler2.ItemInterface;
1717 using SCFiler2.EventInterface;
1818 using System.Runtime.InteropServices;
19+using System.Drawing.Imaging;
1920
20-
2121 namespace SCFiler2 {
2222 /// <summary>
2323 /// ファイル一覧を表示するためのビュー(SCFilerのメインとなるビュー)
@@ -142,42 +142,81 @@
142142 /// </summary>
143143 /// <param name="type"></param>
144144 public void setViewMode(ViewMode type) {
145- if (type == viewMode) {
145+ if (type == viewMode) { //変更なしだったら何もしないで抜ける
146146 return;
147147 }
148148
149+ //まず現在の状態を終了する
150+ switch (this.viewMode) {
151+ case ViewMode.PreviewInPreviewMode:
152+ this.exitPreview();
153+ break;
154+ case ViewMode.ThumbnailMode:
155+ this.exitThumbnailMode();
156+ break;
157+ } 
158+
149159 FileView anotherView = MainForm.Instance.GetAnotherFileView(this);
150160
151161 switch (type) {
152162 case ViewMode.Normal:
153- if (this.viewMode == ViewMode.PreviewInPreviewMode) {
154- //現在プレビュー状態だったらやめる
155- this.exitPreview();
156- }
163+ this.listView.View = View.Details;
157164 this.listView.Visible = true;
158165 this.listView.Dock = DockStyle.Fill;
159166 this.previewPictureBox.Visible = false;
160167 this.viewMode = ViewMode.Normal;
161- anotherView.setViewMode(ViewMode.Normal);
162168 break;
163- case ViewMode.ListInPreviewMode:
164- this.listView.Visible = true;
165- this.listView.Dock = DockStyle.Fill;
166- this.previewPictureBox.Visible = false;
167- this.viewMode = ViewMode.ListInPreviewMode;
168- anotherView.setViewMode(ViewMode.PreviewInPreviewMode);
169- break;
169+ //case ViewMode.ListInPreviewMode:
170+ // this.listView.Visible = true;
171+ // this.listView.Dock = DockStyle.Fill;
172+ // this.listView.View = View.Details;
173+ // this.previewPictureBox.Visible = false;
174+ // this.viewMode = ViewMode.ListInPreviewMode;
175+ // anotherView.setViewMode(ViewMode.PreviewInPreviewMode);
176+ // break;
170177 case ViewMode.PreviewInPreviewMode:
171178 this.previewPictureBox.Visible = true;
172179 this.previewPictureBox.Dock = DockStyle.Fill;
173180 this.listView.Visible = false;
174181 this.viewMode = ViewMode.PreviewInPreviewMode;
175- anotherView.setViewMode(ViewMode.ListInPreviewMode);
182+ //anotherView.setViewMode(ViewMode.ListInPreviewMode);
176183 this.drawPreview(anotherView.FocusedFilerItem);
177184 break;
185+ case ViewMode.ThumbnailMode:
186+ this.listView.Visible = true;
187+ this.listView.Dock = DockStyle.Fill;
188+ this.listView.View = View.LargeIcon;
189+ this.previewPictureBox.Visible = false;
190+ this.viewMode = ViewMode.ThumbnailMode;
191+ this.enterThumbnailMode();
192+ break;
178193 }
179194 }
180195
196+ private Image getSizeTransformedImage(Image source, int width, int height, bool IsDoNothingWhenSmall) {
197+ //サイズを合わせる
198+ if (IsDoNothingWhenSmall && source.Width < width && source.Height < height) {
199+ return source;
200+ } else {
201+ Image output = new Bitmap(width, height);
202+ //うまく収まるサイズの計算
203+ float rateX = (float)width / (float)source.Width;
204+ float rateY = (float)height / (float)source.Height;
205+ int newWidth, newHeight;
206+ if (rateX < rateY) { //より小さくなる方にあわせないといけない
207+ newWidth = (int)(source.Width * rateX);
208+ newHeight = (int)(source.Height * rateX);
209+ } else {
210+ newWidth = (int)(source.Width * rateY);
211+ newHeight = (int)(source.Height * rateY);
212+ }
213+ Graphics g = Graphics.FromImage(output);
214+ g.FillRectangle( new SolidBrush(Color.White) , 0, 0, width, height);
215+ g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
216+ g.DrawImage(source, 0, 0, newWidth, newHeight);
217+ return output;
218+ }
219+ }
181220
182221 #region プレビュー関係
183222
@@ -187,14 +226,38 @@
187226 /// プレビュー領域にtargetItemを描画する(今は画像のプレビューのみ)
188227 /// </summary>
189228 /// <param name="targetItem"></param>
190- public void drawPreview(IFilerItem targetItem) {
229+ private void drawPreview(IFilerItem targetItem) {
230+ this.currentPathText.Text = "プレビューモード";
231+
232+ if (targetItem.Type != ItemType.File) { //ファイル以外は表示しない
233+ previewPictureBox.Image = null;//画像を消去
234+ return;
235+ }
236+
191237 if (previewingItem != null && previewingItem.FullName == targetItem.FullName) {
192238 return;
193239 }
194240
195241 Bitmap srcBitmap = susie.GetPicture(targetItem.FullName);
242+
243+ //Susieで表示できないときはWindowsの標準デコーダで表示を試みる
196244 if (srcBitmap == null) {
197- srcBitmap = (Bitmap)Bitmap.FromFile(targetItem.FullName);
245+ try {
246+ ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
247+ foreach (ImageCodecInfo info in codecs) {
248+ string[] extensions = info.FilenameExtension.Split(';');
249+ foreach (string ext in extensions) {
250+ if (String.Compare(targetItem.Extension, 0, ext, 1, ext.Length, true) == 0) {
251+ srcBitmap = (Bitmap)Bitmap.FromFile(targetItem.FullName);
252+ break;
253+ }
254+ }
255+ }
256+ } catch (OutOfMemoryException) {
257+ SCFiler2System.ShowTempMessage("OutOfMemoryエラーです。ファイルが壊れている、または、拡張子が正しくない可能性があります。");
258+ previewPictureBox.Image = null;
259+ return;
260+ }
198261 }
199262
200263 if (srcBitmap != null) {
@@ -230,13 +293,72 @@
230293 }
231294 }
232295
233- public void exitPreview() {
296+ private void exitPreview() {
234297 previewingItem = null;
298+ this.currentPathText.Text = this.currentPath;
235299 }
236300
237301 #endregion プレビュー関係
238302
303+ #region サムネイル関係
304+
305+ private void enterThumbnailMode() {
306+ int thumbnailWidth = SCFiler2System.Instance.Option.FileView.ThumbnailWidth;
307+ int thumbnailHeight = SCFiler2System.Instance.Option.FileView.ThumbnailHeight;
308+
309+ this.listView.View = View.LargeIcon;
310+ this.listView.LargeImageList = new ImageList();
311+
312+ this.listView.LargeImageList.ImageSize = new Size(thumbnailWidth, thumbnailHeight);
313+
314+ Bitmap folderIcon = Icons.Folder.ToBitmap();
315+ Image folderThumbnail = getSizeTransformedImage(folderIcon, thumbnailWidth, thumbnailHeight, false);
316+ foreach (VirtualListViewItem item in this.virtualListView.Items) {
317+ switch (item.FilerItem.Type) {
318+ case ItemType.Folder:
319+ this.listView.LargeImageList.Images.Add(folderThumbnail);
320+ item.Item.ImageIndex = this.listView.LargeImageList.Images.Count - 1;
321+ break;
322+ case ItemType.File:
323+ Bitmap image = null;
324+ try {
325+ image = (Bitmap)ImageUtil.getImage(item.FilerItem);
326+ } catch (OutOfMemoryException) {
327+ SCFiler2System.ShowHistoryMessage(item.FilerItem.Name + "は読み込めません");
328+ }
329+ if (image != null) {
330+ this.listView.LargeImageList.Images.Add(getSizeTransformedImage(image, thumbnailWidth, thumbnailHeight, false));
331+ item.Item.ImageIndex = this.listView.LargeImageList.Images.Count - 1;
332+ image.Dispose();
333+ break;
334+ } else {
335+ item.Item.ImageIndex = -1;
336+ break;
337+ }
338+ default:
339+ item.Item.ImageIndex = -1;
340+ break;
341+ }
342+
343+ }
344+ }
345+
239346 /// <summary>
347+ /// サムネイル表示を終了するときの処理
348+ /// </summary>
349+ private void exitThumbnailMode() {
350+ if (this.viewMode != ViewMode.ThumbnailMode) {
351+ return;
352+ }
353+
354+ foreach (VirtualListViewItem item in this.virtualListView.Items) {
355+ item.Item.ImageIndex = item.SmallImageIndex;
356+ }
357+ }
358+
359+ #endregion サムネイル関係
360+
361+ /// <summary>
240362 /// 終了時にMainFormから呼ばれる
241363 /// </summary>
242364 public void Terminate() {
@@ -281,6 +403,12 @@
281403 SCFiler2System.ShowDialogMessage(fullName+"は存在しないか、アクセスできません");
282404 return;
283405 }
406+
407+ if (this.viewMode == ViewMode.ThumbnailMode) {
408+ exitThumbnailMode();
409+ setViewMode(ViewMode.Normal);
410+ }
411+
284412 previousPath = currentPath;
285413 currentPath = fullName;
286414 NarrowDownTextBox.Text = "";
@@ -561,6 +689,11 @@
561689 /// <param name="sender"></param>
562690 /// <param name="e"></param>
563691 private void fileListView_KeyDown(object sender, KeyEventArgs e) {
692+ if (this.listView.View == View.LargeIcon && (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) &&
693+ !e.Shift && !e.Control && !e.Alt) {
694+ return;
695+ }
696+
564697 //ListViewコントローラの優先処理
565698 ListViewController.Result result = currentListViewController.KeyProcessingBeforeKeyCommand(e);
566699 switch (result) {
@@ -923,15 +1056,6 @@
9231056
9241057 }
9251058
926- /// <summary>
927- /// フォーカスしているアイテムが替わった時の処理
928- /// </summary>
929- public void FocusedItemChanged() {
930- if (ViewMode == ViewMode.ListInPreviewMode) {
931- MainForm.Instance.GetAnotherFileView(this).drawPreview(this.FocusedFilerItem);
932- }
933- }
934-
9351059 private void fileSystemWatcher_Changed(object sender, System.IO.FileSystemEventArgs e) {
9361060 this.isNeedToUpdateView = true;
9371061 }
@@ -958,10 +1082,6 @@
9581082 if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) {
9591083 int index = this.listView.GetItemAt(e.X, e.Y).Index;
9601084 this.virtualListView.Items[index].Focused = true;
961- //ControlキーもShiftキーも押されていないなら、選択開始アイテムをクリックされたアイテムに変更
962- if ((Control.ModifierKeys & Keys.Shift) != Keys.Shift && (Control.ModifierKeys & Keys.Control) != Keys.Control) {
963- this.virtualListView.SelectionStartItem = this.virtualListView.Items[index];
964- }
9651085 }
9661086 }
9671087
@@ -1111,8 +1231,10 @@
11111231 }
11121232
11131233 private void focusChangedEvent(int index) {
1114- if (this.viewMode == ViewMode.ListInPreviewMode) {
1115- MainForm.Instance.GetAnotherFileView(this).drawPreview(this.virtualListView.FocusedItem.FilerItem);
1234+ FileView anotherview = MainForm.Instance.GetAnotherFileView(this);
1235+ if (anotherview.viewMode == ViewMode.PreviewInPreviewMode) {
1236+ IFilerItem item = this.virtualListView.FocusedItem.FilerItem;
1237+ anotherview.drawPreview(item);
11161238 }
11171239 }
11181240 }
--- SCFiler2/VirtualListView.cs (revision 88)
+++ SCFiler2/VirtualListView.cs (revision 89)
@@ -42,14 +42,10 @@
4242 this.selectedIndexCollection = new SelectedIndexCollection(this);
4343 this.sorter = new VirtualListViewComparer(0);
4444 this.targetView.SmallImageList = new ImageList();
45- this.InitializeSmallImageList();
45+ this.targetView.LargeImageList = new ImageList();
46+ this.InitializeImageList();
4647 }
4748
48- private VirtualListViewItem selectionStartItem;
49- public VirtualListViewItem SelectionStartItem {
50- get { return this.selectionStartItem; }
51- set { this.selectionStartItem = value; }
52- }
5349
5450 /// <summary>
5551 /// VirtualListViewが管理する対象のListViewを取得する
@@ -63,9 +59,8 @@
6359 /// </summary>
6460 public void Clear() {
6561 this.itemCollection.Clear();
66- this.InitializeSmallImageList();
62+ this.InitializeImageList();
6763 this.targetView.VirtualListSize = 0;
68- this.selectionStartItem = null;
6964 }
7065
7166 /// <summary>
@@ -80,18 +75,28 @@
8075 /// </summary>
8176 public VirtualListViewItem FocusedItem {
8277 get {
83- foreach (VirtualListViewItem item in this.Items) {
84- if (item.Focused) {
85- return item;
86- }
78+ if (this.targetView.FocusedItem == null) {
79+ return null;
80+ } else {
81+ return this.itemList[this.targetView.FocusedItem.Index];
8782 }
88- return null;
83+ //foreach (VirtualListViewItem item in this.Items) {
84+ // if (item.Focused) {
85+ // return item;
86+ // }
87+ //}
88+ //return null;
8989 }
9090 set {
91- if (this.focusedItem != null && this.focusedItem == value) {
92- this.focusedItem.Focused = false;
91+ if (value == null) {
92+ this.targetView.FocusedItem = null;
93+ } else {
94+ this.targetView.FocusedItem = value.Item;
9395 }
94- this.focusedItem = value;
96+ //if (this.focusedItem != null && this.focusedItem == value) {
97+ // this.focusedItem.Focused = false;
98+ //}
99+ //this.focusedItem = value;
95100 }
96101 }
97102
@@ -194,9 +199,9 @@
194199 }
195200
196201 #region Imageindex関係
197- private Dictionary<string, int> imageKeyToIndex = new Dictionary<string, int>();
202+ private Dictionary<string, System.Drawing.Icon> smallImageListDictionary = new Dictionary<string, System.Drawing.Icon>();
198203
199- internal void InitializeSmallImageList() {
204+ internal void InitializeImageList() {
200205 this.targetView.SmallImageList.Images.Clear();
201206 this.targetView.SmallImageList.Images.Add(Icons.Folder);
202207 this.targetView.SmallImageList.Images.Add(Icons.Hdd);
@@ -203,33 +208,15 @@
203208 this.targetView.SmallImageList.Images.Add(Icons.CDROM);
204209 this.targetView.SmallImageList.Images.Add(Icons.RemovableDrive);
205210 this.targetView.SmallImageList.Images.Add(Icons.NetworkDrive);
206- this.imageKeyToIndex.Clear();
207211 }
208212
209213
210- internal void RegistImage(string key, System.Drawing.Icon icon) {
214+ internal int RegistSmallImage(string key, System.Drawing.Icon icon) {
211215 string keyUpper = key.ToUpper();
212- if (!this.targetView.SmallImageList.Images.ContainsKey(keyUpper)) {
213- this.targetView.SmallImageList.Images.Add(keyUpper, icon);
214- this.imageKeyToIndex[keyUpper] = this.targetView.SmallImageList.Images.Count - 1;
215- }
216+ this.targetView.SmallImageList.Images.Add(icon);
217+ return this.targetView.SmallImageList.Images.Count - 1;
216218 }
217219
218- internal bool IsContainsImage(string key) {
219- return this.imageKeyToIndex.ContainsKey(key.ToUpper());
220- }
221-
222- internal int GetImageIndex(string key) {
223- return this.imageKeyToIndex[key.ToUpper()];
224- }
225-
226- /// <summary>
227- /// フォルダのImageIndexを取得する(ListViewItemのImageIndex)
228- /// </summary>
229- /// <returns></returns>
230- internal int GetFolderImageIndex() {
231- return (int)IconListIndex.Folder;
232- }
233220 #endregion
234221
235222 /// <summary>
--- SCFiler2/SCFiler2System.cs (revision 88)
+++ SCFiler2/SCFiler2System.cs (revision 89)
@@ -66,6 +66,8 @@
6666 public bool IsDisplayDriveToolbar = true;
6767 public bool IsDisplayHistoryView = true;
6868 public FileIconDisp IconDisplay = FileIconDisp.Nothing;
69+ public int ThumbnailWidth = 120;
70+ public int ThumbnailHeight = 120;
6971
7072 public void Save() {
7173 OptionUtil.Save("FileViewOption", this);
--- SCFiler2/OptionDialog.Designer.cs (revision 88)
+++ SCFiler2/OptionDialog.Designer.cs (revision 89)
@@ -42,6 +42,10 @@
4242 this.tabPage3 = new System.Windows.Forms.TabPage();
4343 this.changeDriveByNumkeyCheckbox = new System.Windows.Forms.CheckBox();
4444 this.tabPage7 = new System.Windows.Forms.TabPage();
45+ this.groupBox2 = new System.Windows.Forms.GroupBox();
46+ this.FileIconAllDisplayRadioBUtton = new System.Windows.Forms.RadioButton();
47+ this.FileIconOnlyExeDisplayRadioButton = new System.Windows.Forms.RadioButton();
48+ this.FileIconNotDisplayRadioButton = new System.Windows.Forms.RadioButton();
4549 this.IsHideHistoryViewCheckbox = new System.Windows.Forms.CheckBox();
4650 this.IsHideDriveToolbarCheckbox = new System.Windows.Forms.CheckBox();
4751 this.label6 = new System.Windows.Forms.Label();
@@ -108,15 +112,16 @@
108112 this.externalToolAssignControl3 = new SCFiler2.ExternalToolAssignControl();
109113 this.externalToolAssignControl2 = new SCFiler2.ExternalToolAssignControl();
110114 this.externalToolAssignControl1 = new SCFiler2.ExternalToolAssignControl();
111- this.groupBox2 = new System.Windows.Forms.GroupBox();
112- this.FileIconNotDisplayRadioButton = new System.Windows.Forms.RadioButton();
113- this.FileIconOnlyExeDisplayRadioButton = new System.Windows.Forms.RadioButton();
114- this.FileIconAllDisplayRadioBUtton = new System.Windows.Forms.RadioButton();
115+ this.label21 = new System.Windows.Forms.Label();
116+ this.ThumbnailWidthTextbox = new System.Windows.Forms.TextBox();
117+ this.ThumbnailHeightTextbox = new System.Windows.Forms.TextBox();
118+ this.label22 = new System.Windows.Forms.Label();
115119 this.tabControl1.SuspendLayout();
116120 this.tabPage1.SuspendLayout();
117121 this.tabPage2.SuspendLayout();
118122 this.tabPage3.SuspendLayout();
119123 this.tabPage7.SuspendLayout();
124+ this.groupBox2.SuspendLayout();
120125 this.tabPage4.SuspendLayout();
121126 this.tabPage5.SuspendLayout();
122127 this.tabPage6.SuspendLayout();
@@ -124,7 +129,6 @@
124129 this.groupBox1.SuspendLayout();
125130 this.tabPage9.SuspendLayout();
126131 this.tabPage10.SuspendLayout();
127- this.groupBox2.SuspendLayout();
128132 this.SuspendLayout();
129133 //
130134 // tabControl1
@@ -335,6 +339,10 @@
335339 //
336340 // tabPage7
337341 //
342+ this.tabPage7.Controls.Add(this.label22);
343+ this.tabPage7.Controls.Add(this.ThumbnailHeightTextbox);
344+ this.tabPage7.Controls.Add(this.ThumbnailWidthTextbox);
345+ this.tabPage7.Controls.Add(this.label21);
338346 this.tabPage7.Controls.Add(this.groupBox2);
339347 this.tabPage7.Controls.Add(this.IsHideHistoryViewCheckbox);
340348 this.tabPage7.Controls.Add(this.IsHideDriveToolbarCheckbox);
@@ -350,6 +358,51 @@
350358 this.tabPage7.Text = "表示";
351359 this.tabPage7.UseVisualStyleBackColor = true;
352360 //
361+ // groupBox2
362+ //
363+ this.groupBox2.Controls.Add(this.FileIconAllDisplayRadioBUtton);
364+ this.groupBox2.Controls.Add(this.FileIconOnlyExeDisplayRadioButton);
365+ this.groupBox2.Controls.Add(this.FileIconNotDisplayRadioButton);
366+ this.groupBox2.Location = new System.Drawing.Point(422, 58);
367+ this.groupBox2.Name = "groupBox2";
368+ this.groupBox2.Size = new System.Drawing.Size(134, 92);
369+ this.groupBox2.TabIndex = 8;
370+ this.groupBox2.TabStop = false;
371+ this.groupBox2.Text = "ファイルのアイコン";
372+ //
373+ // FileIconAllDisplayRadioBUtton
374+ //
375+ this.FileIconAllDisplayRadioBUtton.AutoSize = true;
376+ this.FileIconAllDisplayRadioBUtton.Location = new System.Drawing.Point(7, 63);
377+ this.FileIconAllDisplayRadioBUtton.Name = "FileIconAllDisplayRadioBUtton";
378+ this.FileIconAllDisplayRadioBUtton.Size = new System.Drawing.Size(68, 16);
379+ this.FileIconAllDisplayRadioBUtton.TabIndex = 2;
380+ this.FileIconAllDisplayRadioBUtton.TabStop = true;
381+ this.FileIconAllDisplayRadioBUtton.Text = "全て表示";
382+ this.FileIconAllDisplayRadioBUtton.UseVisualStyleBackColor = true;
383+ //
384+ // FileIconOnlyExeDisplayRadioButton
385+ //
386+ this.FileIconOnlyExeDisplayRadioButton.AutoSize = true;
387+ this.FileIconOnlyExeDisplayRadioButton.Location = new System.Drawing.Point(7, 41);
388+ this.FileIconOnlyExeDisplayRadioButton.Name = "FileIconOnlyExeDisplayRadioButton";
389+ this.FileIconOnlyExeDisplayRadioButton.Size = new System.Drawing.Size(120, 16);
390+ this.FileIconOnlyExeDisplayRadioButton.TabIndex = 1;
391+ this.FileIconOnlyExeDisplayRadioButton.TabStop = true;
392+ this.FileIconOnlyExeDisplayRadioButton.Text = "exeファイルのみ表示";
393+ this.FileIconOnlyExeDisplayRadioButton.UseVisualStyleBackColor = true;
394+ //
395+ // FileIconNotDisplayRadioButton
396+ //
397+ this.FileIconNotDisplayRadioButton.AutoSize = true;
398+ this.FileIconNotDisplayRadioButton.Location = new System.Drawing.Point(7, 19);
399+ this.FileIconNotDisplayRadioButton.Name = "FileIconNotDisplayRadioButton";
400+ this.FileIconNotDisplayRadioButton.Size = new System.Drawing.Size(76, 16);
401+ this.FileIconNotDisplayRadioButton.TabIndex = 0;
402+ this.FileIconNotDisplayRadioButton.TabStop = true;
403+ this.FileIconNotDisplayRadioButton.Text = "表示しない";
404+ this.FileIconNotDisplayRadioButton.UseVisualStyleBackColor = true;
405+ //
353406 // IsHideHistoryViewCheckbox
354407 //
355408 this.IsHideHistoryViewCheckbox.AutoSize = true;
@@ -991,50 +1044,39 @@
9911044 this.externalToolAssignControl1.Size = new System.Drawing.Size(548, 29);
9921045 this.externalToolAssignControl1.TabIndex = 0;
9931046 //
994- // groupBox2
1047+ // label21
9951048 //
996- this.groupBox2.Controls.Add(this.FileIconAllDisplayRadioBUtton);
997- this.groupBox2.Controls.Add(this.FileIconOnlyExeDisplayRadioButton);
998- this.groupBox2.Controls.Add(this.FileIconNotDisplayRadioButton);
999- this.groupBox2.Location = new System.Drawing.Point(422, 58);
1000- this.groupBox2.Name = "groupBox2";
1001- this.groupBox2.Size = new System.Drawing.Size(134, 92);
1002- this.groupBox2.TabIndex = 8;
1003- this.groupBox2.TabStop = false;
1004- this.groupBox2.Text = "ファイルのアイコン";
1049+ this.label21.AutoSize = true;
1050+ this.label21.Location = new System.Drawing.Point(420, 162);
1051+ this.label21.Name = "label21";
1052+ this.label21.Size = new System.Drawing.Size(143, 12);
1053+ this.label21.TabIndex = 9;
1054+ this.label21.Text = "サムネイルの大きさ(80~300)";
10051055 //
1006- // FileIconNotDisplayRadioButton
1056+ // ThumbnailWidthTextbox
10071057 //
1008- this.FileIconNotDisplayRadioButton.AutoSize = true;
1009- this.FileIconNotDisplayRadioButton.Location = new System.Drawing.Point(7, 19);
1010- this.FileIconNotDisplayRadioButton.Name = "FileIconNotDisplayRadioButton";
1011- this.FileIconNotDisplayRadioButton.Size = new System.Drawing.Size(76, 16);
1012- this.FileIconNotDisplayRadioButton.TabIndex = 0;
1013- this.FileIconNotDisplayRadioButton.TabStop = true;
1014- this.FileIconNotDisplayRadioButton.Text = "表示しない";
1015- this.FileIconNotDisplayRadioButton.UseVisualStyleBackColor = true;
1058+ this.ThumbnailWidthTextbox.ImeMode = System.Windows.Forms.ImeMode.Off;
1059+ this.ThumbnailWidthTextbox.Location = new System.Drawing.Point(429, 177);
1060+ this.ThumbnailWidthTextbox.Name = "ThumbnailWidthTextbox";
1061+ this.ThumbnailWidthTextbox.Size = new System.Drawing.Size(49, 19);
1062+ this.ThumbnailWidthTextbox.TabIndex = 10;
10161063 //
1017- // OnlyExeIconDisplayRadioButton
1064+ // ThumbnailHeightTextbox
10181065 //
1019- this.FileIconOnlyExeDisplayRadioButton.AutoSize = true;
1020- this.FileIconOnlyExeDisplayRadioButton.Location = new System.Drawing.Point(7, 41);
1021- this.FileIconOnlyExeDisplayRadioButton.Name = "OnlyExeIconDisplayRadioButton";
1022- this.FileIconOnlyExeDisplayRadioButton.Size = new System.Drawing.Size(120, 16);
1023- this.FileIconOnlyExeDisplayRadioButton.TabIndex = 1;
1024- this.FileIconOnlyExeDisplayRadioButton.TabStop = true;
1025- this.FileIconOnlyExeDisplayRadioButton.Text = "exeファイルのみ表示";
1026- this.FileIconOnlyExeDisplayRadioButton.UseVisualStyleBackColor = true;
1066+ this.ThumbnailHeightTextbox.ImeMode = System.Windows.Forms.ImeMode.Off;
1067+ this.ThumbnailHeightTextbox.Location = new System.Drawing.Point(507, 177);
1068+ this.ThumbnailHeightTextbox.Name = "ThumbnailHeightTextbox";
1069+ this.ThumbnailHeightTextbox.Size = new System.Drawing.Size(49, 19);
1070+ this.ThumbnailHeightTextbox.TabIndex = 11;
10271071 //
1028- // FileIconAllDisplayRadioBUtton
1072+ // label22
10291073 //
1030- this.FileIconAllDisplayRadioBUtton.AutoSize = true;
1031- this.FileIconAllDisplayRadioBUtton.Location = new System.Drawing.Point(7, 63);
1032- this.FileIconAllDisplayRadioBUtton.Name = "FileIconAllDisplayRadioBUtton";
1033- this.FileIconAllDisplayRadioBUtton.Size = new System.Drawing.Size(68, 16);
1034- this.FileIconAllDisplayRadioBUtton.TabIndex = 2;
1035- this.FileIconAllDisplayRadioBUtton.TabStop = true;
1036- this.FileIconAllDisplayRadioBUtton.Text = "全て表示";
1037- this.FileIconAllDisplayRadioBUtton.UseVisualStyleBackColor = true;
1074+ this.label22.AutoSize = true;
1075+ this.label22.Location = new System.Drawing.Point(485, 181);
1076+ this.label22.Name = "label22";
1077+ this.label22.Size = new System.Drawing.Size(17, 12);
1078+ this.label22.TabIndex = 12;
1079+ this.label22.Text = "×";
10381080 //
10391081 // OptionDialog
10401082 //
@@ -1057,6 +1099,8 @@
10571099 this.tabPage3.PerformLayout();
10581100 this.tabPage7.ResumeLayout(false);
10591101 this.tabPage7.PerformLayout();
1102+ this.groupBox2.ResumeLayout(false);
1103+ this.groupBox2.PerformLayout();
10601104 this.tabPage4.ResumeLayout(false);
10611105 this.tabPage4.PerformLayout();
10621106 this.tabPage5.ResumeLayout(false);
@@ -1069,8 +1113,6 @@
10691113 this.tabPage9.PerformLayout();
10701114 this.tabPage10.ResumeLayout(false);
10711115 this.tabPage10.PerformLayout();
1072- this.groupBox2.ResumeLayout(false);
1073- this.groupBox2.PerformLayout();
10741116 this.ResumeLayout(false);
10751117
10761118 }
@@ -1166,5 +1208,9 @@
11661208 private System.Windows.Forms.RadioButton FileIconNotDisplayRadioButton;
11671209 private System.Windows.Forms.RadioButton FileIconAllDisplayRadioBUtton;
11681210 private System.Windows.Forms.RadioButton FileIconOnlyExeDisplayRadioButton;
1211+ private System.Windows.Forms.Label label21;
1212+ private System.Windows.Forms.TextBox ThumbnailHeightTextbox;
1213+ private System.Windows.Forms.TextBox ThumbnailWidthTextbox;
1214+ private System.Windows.Forms.Label label22;
11691215 }
11701216 }
\ No newline at end of file
--- SCFiler2/VirtualListViewItem.cs (revision 88)
+++ SCFiler2/VirtualListViewItem.cs (revision 89)
@@ -73,11 +73,6 @@
7373 //何もしない
7474 }
7575 }
76- if (this.parentView.SelectedItems.Count == 1) {
77- this.parentView.SelectionStartItem = this;
78- } else if (this.parentView.SelectedItems.Count == 0) {
79- this.parentView.SelectionStartItem = null;
80- }
8176 }
8277
8378 get {
@@ -90,20 +85,11 @@
9085 /// </summary>
9186 public bool Focused {
9287 set {
93- if (this.viewItem != null) {
94- this.viewItem.Focused = value;
95- } else {
96- this.createListViewItem();
97- this.viewItem.Focused = value;
98- }
88+ this.parentView.AssignedListView.Items[this.Index].Focused = value;
9989 }
10090
10191 get {
102- if (this.viewItem == null) {
103- return false;
104- } else {
105- return this.viewItem.Focused;
106- }
92+ return this.parentView.AssignedListView.Items[this.Index].Focused;
10793 }
10894 }
10995
@@ -147,6 +133,17 @@
147133 this.parentView.EnsureVisible(this.Index);
148134 }
149135
136+ private int smallImageIndex = -1;
137+ public int SmallImageIndex {
138+ get { return smallImageIndex; }
139+ }
140+
141+ private int largeImageIndex = -1;
142+ public int LargeImageIndex {
143+ get { return largeImageIndex;}
144+ set { largeImageIndex = value; }
145+ }
146+
150147 /// <summary>
151148 /// このVirtualListViewItemが表すListViewItemを生成する
152149 /// </summary>
@@ -158,6 +155,7 @@
158155 switch (this.targetItem.Type) {
159156 case ItemType.Folder:
160157 this.viewItem.SubItems.Add("<dir>");//拡張子列
158+ this.smallImageIndex = 0;
161159 this.viewItem.ImageIndex = 0;
162160 break;
163161 case ItemType.File:
@@ -168,16 +166,11 @@
168166 //何も表示しない
169167 } else {
170168 if (targetItem.Extension.ToUpper() == ".EXE") { // exeはどちらのモードでも表示
171- this.parentView.RegistImage(targetItem.Name, System.Drawing.Icon.ExtractAssociatedIcon(targetItem.FullName));
172- this.viewItem.ImageIndex = this.parentView.GetImageIndex(targetItem.Name);
169+ this.smallImageIndex = this.parentView.RegistSmallImage(targetItem.Name, targetItem.Icon);
170+ this.viewItem.ImageIndex = this.smallImageIndex;
173171 } else if (SCFiler2System.Instance.Option.FileView.IconDisplay == SCFiler2System.OptionClass.FileViewOption.FileIconDisp.All) {
174- //登録済みだったらindexを取得、でなければ登録して登録したindexを取得
175- if (this.parentView.IsContainsImage(targetItem.Extension)) {
176- this.viewItem.ImageIndex = this.parentView.GetImageIndex(targetItem.Extension);
177- } else {
178- this.parentView.RegistImage(targetItem.Extension, System.Drawing.Icon.ExtractAssociatedIcon(targetItem.FullName));
179- this.viewItem.ImageIndex = this.parentView.GetImageIndex(targetItem.Extension);
180- }
172+ this.smallImageIndex = this.parentView.RegistSmallImage(targetItem.Extension, targetItem.Icon);
173+ this.viewItem.ImageIndex = this.smallImageIndex;
181174 }
182175 }
183176 break;
@@ -185,21 +178,22 @@
185178 Drive drive = (Drive)targetItem;
186179 switch (drive.DriveType) {
187180 case System.IO.DriveType.Fixed:
188- this.viewItem.ImageIndex = (int)VirtualListView.IconListIndex.Hdd;
181+ this.smallImageIndex = (int)VirtualListView.IconListIndex.Hdd;
189182 break;
190183 case System.IO.DriveType.CDRom:
191- this.viewItem.ImageIndex = (int)VirtualListView.IconListIndex.CDROM;
184+ this.smallImageIndex = (int)VirtualListView.IconListIndex.CDROM;
192185 break;
193186 case System.IO.DriveType.Removable:
194- this.viewItem.ImageIndex = (int)VirtualListView.IconListIndex.Removable;
187+ this.smallImageIndex = (int)VirtualListView.IconListIndex.Removable;
195188 break;
196189 case System.IO.DriveType.Network:
197- this.viewItem.ImageIndex = (int)VirtualListView.IconListIndex.NetworkDrive;
190+ this.smallImageIndex = (int)VirtualListView.IconListIndex.NetworkDrive;
198191 break;
199192 default:
200- this.viewItem.ImageIndex = (int)VirtualListView.IconListIndex.Hdd;
193+ this.smallImageIndex = (int)VirtualListView.IconListIndex.Hdd;
201194 break;
202195 }
196+ this.viewItem.ImageIndex = this.smallImageIndex;
203197 this.viewItem.SubItems.Add("");
204198 break;
205199 }
--- SCFiler2/bin/Release/ReleaseNote.txt (revision 88)
+++ SCFiler2/bin/Release/ReleaseNote.txt (revision 89)
@@ -1,6 +1,7 @@
11 更新履歴
22
33 ■0.39
4+・サムネイル表示に対応した
45 ・キー割り当てを以下のキーに対して可能にした
56 矢印上下、Home, End, PageUp, PageDown, insert
67 制約として、Ctrl+矢印およびCtrl+スペースキーに割り当てた機能は、「スペースで選択」モードではキーが効きません
--- SCFiler2/ListViewController.cs (revision 88)
+++ SCFiler2/ListViewController.cs (revision 89)
@@ -144,53 +144,19 @@
144144 this.targetListView.SelectedItems.Clear();
145145 destItem.Selected = true;
146146 destItem.Focused = true;
147- this.parentView.FocusedItemChanged();
147+ //this.parentView.FocusedItemChanged();
148148 destItem.EnsureVisible();
149149
150- this.targetListView.SelectionStartItem = destItem;
151150 this.targetListView.Update();
152151 }
153152
154153 /// <summary>
155- /// 選択開始アイテムからdestItemまでを選択状態にし、destItemにフォーカスを移す
156- /// </summary>
157- /// <param name="destItem"></param>
158- protected void SelectingMove(VirtualListViewItem destItem) {
159- if (this.targetListView.SelectionStartItem == null) {
160- this.targetListView.SelectionStartItem = this.targetListView.FocusedItem;
161- }
162-
163- VirtualListViewItem start = this.targetListView.SelectionStartItem;
164- if (start == null && !targetListView.SelectedItems.Contains(this.targetListView.SelectionStartItem)) {
165- start = targetListView.SelectedItems[0];
166- }
167- VirtualListViewItem from, to;
168- if (start.Index < destItem.Index) {
169- from = start;
170- to = destItem;
171- } else {
172- from = destItem;
173- to = start;
174- }
175-
176- this.targetListView.SelectedItems.Clear();
177- for (int i = from.Index; i <= to.Index; i++) {
178- targetListView.Items[i].Selected = true;
179- }
180- destItem.Focused = true;
181- this.targetListView.SelectionStartItem = start;
182- this.parentView.FocusedItemChanged();
183- destItem.EnsureVisible();
184- this.targetListView.Update();
185- }
186-
187- /// <summary>
188154 /// 現在の選択状態は一切変更せずに、フォーカスのみdestItemに移す
189155 /// </summary>
190156 /// <param name="destItem"></param>
191157 protected void OnlyFocusMove(VirtualListViewItem destItem) {
192158 destItem.Focused = true;
193- this.parentView.FocusedItemChanged();
159+ //this.parentView.FocusedItemChanged();
194160 destItem.EnsureVisible();
195161 this.targetListView.Update();
196162 }
--- SCFiler2/PreviewMode.cs (revision 88)
+++ SCFiler2/PreviewMode.cs (revision 89)
@@ -18,12 +18,10 @@
1818 IFileView focusedView = ViewInterfaces.LastFocusedFileView;
1919 IFileView unfocusedView = ViewInterfaces.OtherOfLastFocusedFileView;
2020
21- if (focusedView.ViewMode == ViewMode.Normal) {
22- focusedView.ViewMode = ViewMode.ListInPreviewMode;
21+ if (unfocusedView.ViewMode != ViewMode.PreviewInPreviewMode) {
2322 unfocusedView.ViewMode = ViewMode.PreviewInPreviewMode;
2423 } else {
2524 //すでにプレビュー中だったらプレビューモードを抜ける
26- focusedView.ViewMode = ViewMode.Normal;
2725 unfocusedView.ViewMode = ViewMode.Normal;
2826 }
2927 }
Show on old repository browser