• R/O
  • SSH
  • HTTPS

scfiler: Commit


Commit MetaInfo

Revision75 (tree)
Time2009-03-18 00:24:01
Authoryuki_sc

Log Message

履歴ビューの保持件数の設定可能

Change Summary

Incremental Difference

--- SCFiler2/OptionDialog.cs (revision 74)
+++ SCFiler2/OptionDialog.cs (revision 75)
@@ -64,6 +64,14 @@
6464 mainForm.FileHistoryManager2.SetValidExtension(historyview2ValidExtensionsString.Text);
6565 mainForm.FileHistoryManager2.Save();
6666 system.Option.Application.IsAddItemToHistoryWhenDrag = this.IsAddItemToHistoryWhenDrag.Checked;
67+ try {
68+ int num = int.Parse(this.HistoryViewItemMax.Text.ToString());
69+ if (num <= 250) {
70+ system.Option.HistoryView.ItemMaxNum = num;
71+ }
72+ } catch {
73+ //Exceptionの時は何もしない。元の値のまま
74+ }
6775
6876 //■外部ツールタブ
6977 for (int i = 0; i < ExternalToolManager.MaxToolNum; i++) {
@@ -153,6 +161,7 @@
153161 historyview1ValidExtensionsString.Text = MainForm.Instance.FileHistoryManager1.GetValidExtension();
154162 historyview2ValidExtensionsString.Text = MainForm.Instance.FileHistoryManager2.GetValidExtension();
155163 this.IsAddItemToHistoryWhenDrag.Checked = system.Option.Application.IsAddItemToHistoryWhenDrag;
164+ this.HistoryViewItemMax.Text = system.Option.HistoryView.ItemMaxNum.ToString();
156165
157166 //■色タブ
158167 colorActiveViewTitle.initialize("アクティブなビューのタイトル", system.Option.Color.ActiveViewTitleText, system.Option.Color.ActiveViewTitleBack);
--- SCFiler2/FileView.cs (revision 74)
+++ SCFiler2/FileView.cs (revision 75)
@@ -299,7 +299,7 @@
299299 if (this.virtualListView.Items.Count > 0) {
300300 SetFocusAndSelected(this.virtualListView.Items[0].FilerItem.FullName);
301301 }
302- if (this.currentPath == "") {
302+ if (this.currentPath == "" || fullName == "") {
303303 this.fileSystemWatcher.EnableRaisingEvents = false;
304304 } else {
305305 this.fileSystemWatcher.EnableRaisingEvents = true;
--- SCFiler2/Drive.cs (revision 74)
+++ SCFiler2/Drive.cs (revision 75)
@@ -1,6 +1,7 @@
11 using System;
22 using System.Collections.Generic;
33 using System.Text;
4+using SCFiler2;
45 using SCFiler2.Util;
56
67 namespace SCFiler2.FileSystem {
@@ -33,7 +34,14 @@
3334 }
3435
3536 public override string NameWithoutExtension {
36- get { return this.info.VolumeLabel + "(" + this.info.RootDirectory + ")"; }
37+ get {
38+ //フロッピーの時はアクセス時間短縮(A:と決めうち)
39+ if (SCFiler2System.Instance.Option.Application.IsIgnoreFloppyCheck && this.info.Name.StartsWith(@"A:", true, null)) {
40+ return "(" + this.info.RootDirectory + ")";
41+ } else {
42+ return this.info.VolumeLabel + "(" + this.info.RootDirectory + ")";
43+ }
44+ }
3745 }
3846
3947 public override string Path {
--- SCFiler2/About.Designer.cs (revision 74)
+++ SCFiler2/About.Designer.cs (revision 75)
@@ -35,7 +35,7 @@
3535 this.appName.Name = "appName";
3636 this.appName.Size = new System.Drawing.Size(147, 12);
3737 this.appName.TabIndex = 0;
38- this.appName.Text = "SCFiler2 Alpha version 0.34";
38+ this.appName.Text = "SCFiler2 Alpha version 0.35";
3939 //
4040 // okButton
4141 //
--- SCFiler2/SCFiler2System.cs (revision 74)
+++ SCFiler2/SCFiler2System.cs (revision 75)
@@ -70,6 +70,19 @@
7070 }
7171 public FileViewOption FileView = new FileViewOption();
7272
73+ public class HistoryViewOption {
74+ public int ItemMaxNum = 30;
75+
76+ public void Save() {
77+ OptionUtil.Save("HistoryViewOption", this);
78+ }
79+
80+ public void Load() {
81+ OptionUtil.Load("HistoryViewOption", this);
82+ }
83+ }
84+ public HistoryViewOption HistoryView = new HistoryViewOption();
85+
7386 public class ApplicationOption {
7487 public bool IsIgnoreFloppyCheck = true;
7588 public bool IsMinimizeFormWhenAppStart = false;
@@ -91,6 +104,7 @@
91104 Color.Save();
92105 FileView.Save();
93106 Application.Save();
107+ HistoryView.Save();
94108 }
95109 public void Load() {
96110 KeyCommand.Load();
@@ -97,6 +111,7 @@
97111 Color.Load();
98112 FileView.Load();
99113 Application.Load();
114+ HistoryView.Load();
100115 }
101116 }
102117 public OptionClass Option = new OptionClass();
--- SCFiler2/OptionDialog.Designer.cs (revision 74)
+++ SCFiler2/OptionDialog.Designer.cs (revision 75)
@@ -42,6 +42,7 @@
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.IsHideHistoryViewCheckbox = new System.Windows.Forms.CheckBox();
4546 this.IsHideDriveToolbarCheckbox = new System.Windows.Forms.CheckBox();
4647 this.label6 = new System.Windows.Forms.Label();
4748 this.excludeExtension = new System.Windows.Forms.TextBox();
@@ -97,7 +98,8 @@
9798 this.cancel_button = new System.Windows.Forms.Button();
9899 this.ok_button = new System.Windows.Forms.Button();
99100 this.colorDialog = new System.Windows.Forms.ColorDialog();
100- this.IsHideHistoryViewCheckbox = new System.Windows.Forms.CheckBox();
101+ this.label18 = new System.Windows.Forms.Label();
102+ this.HistoryViewItemMax = new System.Windows.Forms.TextBox();
101103 this.tabControl1.SuspendLayout();
102104 this.tabPage1.SuspendLayout();
103105 this.tabPage2.SuspendLayout();
@@ -332,11 +334,21 @@
332334 this.tabPage7.Text = "表示";
333335 this.tabPage7.UseVisualStyleBackColor = true;
334336 //
335- // IsHideDriveToolbar
337+ // IsHideHistoryViewCheckbox
336338 //
339+ this.IsHideHistoryViewCheckbox.AutoSize = true;
340+ this.IsHideHistoryViewCheckbox.Location = new System.Drawing.Point(6, 134);
341+ this.IsHideHistoryViewCheckbox.Name = "IsHideHistoryViewCheckbox";
342+ this.IsHideHistoryViewCheckbox.Size = new System.Drawing.Size(237, 16);
343+ this.IsHideHistoryViewCheckbox.TabIndex = 7;
344+ this.IsHideHistoryViewCheckbox.Text = "履歴ビューを表示しない (次回起動より有効)";
345+ this.IsHideHistoryViewCheckbox.UseVisualStyleBackColor = true;
346+ //
347+ // IsHideDriveToolbarCheckbox
348+ //
337349 this.IsHideDriveToolbarCheckbox.AutoSize = true;
338350 this.IsHideDriveToolbarCheckbox.Location = new System.Drawing.Point(6, 112);
339- this.IsHideDriveToolbarCheckbox.Name = "IsHideDriveToolbar";
351+ this.IsHideDriveToolbarCheckbox.Name = "IsHideDriveToolbarCheckbox";
340352 this.IsHideDriveToolbarCheckbox.Size = new System.Drawing.Size(272, 16);
341353 this.IsHideDriveToolbarCheckbox.TabIndex = 6;
342354 this.IsHideDriveToolbarCheckbox.Text = "ドライブツールバーは表示しない (次回起動より有効)";
@@ -380,6 +392,8 @@
380392 //
381393 // tabPage4
382394 //
395+ this.tabPage4.Controls.Add(this.HistoryViewItemMax);
396+ this.tabPage4.Controls.Add(this.label18);
383397 this.tabPage4.Controls.Add(this.IsAddItemToHistoryWhenDrag);
384398 this.tabPage4.Controls.Add(this.label5);
385399 this.tabPage4.Controls.Add(this.label4);
@@ -859,16 +873,22 @@
859873 this.colorDialog.AnyColor = true;
860874 this.colorDialog.FullOpen = true;
861875 //
862- // IsHideHistoryViewCheckbox
876+ // label18
863877 //
864- this.IsHideHistoryViewCheckbox.AutoSize = true;
865- this.IsHideHistoryViewCheckbox.Location = new System.Drawing.Point(6, 134);
866- this.IsHideHistoryViewCheckbox.Name = "IsHideHistoryViewCheckbox";
867- this.IsHideHistoryViewCheckbox.Size = new System.Drawing.Size(237, 16);
868- this.IsHideHistoryViewCheckbox.TabIndex = 7;
869- this.IsHideHistoryViewCheckbox.Text = "履歴ビューを表示しない (次回起動より有効)";
870- this.IsHideHistoryViewCheckbox.UseVisualStyleBackColor = true;
878+ this.label18.AutoSize = true;
879+ this.label18.Location = new System.Drawing.Point(8, 160);
880+ this.label18.Name = "label18";
881+ this.label18.Size = new System.Drawing.Size(141, 12);
882+ this.label18.TabIndex = 6;
883+ this.label18.Text = "履歴の保持件数(最大250)";
871884 //
885+ // HistoryViewItemMax
886+ //
887+ this.HistoryViewItemMax.Location = new System.Drawing.Point(155, 157);
888+ this.HistoryViewItemMax.Name = "HistoryViewItemMax";
889+ this.HistoryViewItemMax.Size = new System.Drawing.Size(33, 19);
890+ this.HistoryViewItemMax.TabIndex = 7;
891+ //
872892 // OptionDialog
873893 //
874894 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -981,5 +1001,7 @@
9811001 private System.Windows.Forms.Label label16;
9821002 private System.Windows.Forms.CheckBox IsHideDriveToolbarCheckbox;
9831003 private System.Windows.Forms.CheckBox IsHideHistoryViewCheckbox;
1004+ private System.Windows.Forms.TextBox HistoryViewItemMax;
1005+ private System.Windows.Forms.Label label18;
9841006 }
9851007 }
\ No newline at end of file
--- SCFiler2/VirtualListViewItem.cs (revision 74)
+++ SCFiler2/VirtualListViewItem.cs (revision 75)
@@ -166,6 +166,7 @@
166166 private void createListViewItem() {
167167 //あらかじめviewItemにインスタンスを設定しておかないと、Selectedの呼び出し時にcreateListViewItem()の循環呼び出しが起こる
168168 this.viewItem = new ListViewItem(this.targetItem.NameWithoutExtension);//名前列
169+
169170 switch (this.targetItem.Type) {
170171 case FilerItem.ItemType.Folder:
171172 this.viewItem.SubItems.Add("<dir>");//拡張子列
--- SCFiler2/HistoryManager.cs (revision 74)
+++ SCFiler2/HistoryManager.cs (revision 75)
@@ -8,7 +8,6 @@
88 private List<FilerItem> historyList = new List<FilerItem>();//履歴を保存するリスト
99 private HistoryView view; //このマネージャと関連付いているビュー
1010 private string viewName; //関連するビューの名前
11- private const int maxListNum = 30; //履歴をいくつまで保存するか
1211 private int loadedItemNum; //loadしたときからアイテム数が減っていたときにiniファイルから消すために読み込み数を保存しておく
1312
1413 /// <summary>
@@ -74,8 +73,9 @@
7473 }
7574
7675 historyList.Insert(0, registItem);
77- if (historyList.Count > maxListNum) {
78- historyList.RemoveAt(historyList.Count-1);
76+ int max = SCFiler2System.Instance.Option.HistoryView.ItemMaxNum;
77+ if (historyList.Count > max) {
78+ historyList.RemoveRange(max, historyList.Count - max);
7979 }
8080 view.UpdateView();
8181 }
@@ -87,7 +87,9 @@
8787 SettingFile file = SettingFile.Instance;
8888 try {
8989 int num = file.LoadInt(viewName, "Num", 0);
90- for (int i = 0; i < num; i++) {
90+
91+ //設定ファイルに必要以上保存されていても、オプション設定値より数が多くならないようにforを回す
92+ for (int i = 0; i < num && i < SCFiler2System.Instance.Option.HistoryView.ItemMaxNum; i++) {
9193 string str = file.Load(viewName, "History" + i);
9294 historyList.Add(CreateNewItem(str));
9395 }
@@ -94,7 +96,7 @@
9496 loadedItemNum = num;
9597 } catch (Exception) {
9698 SCFiler2System.ShowHistoryMessage("[HistoryManager]履歴情報の読み込みに失敗しました");
97- //不整合があると行けないので全てクリアする
99+ //不整合があるといけないので全てクリアする
98100 historyList.Clear();
99101 loadedItemNum = 0;
100102 }
@@ -108,7 +110,7 @@
108110 int index = 0;
109111
110112 file.Save(viewName, "Num", historyList.Count.ToString());
111- for (index = 0; index < historyList.Count; index++) {
113+ for (index = 0; index < historyList.Count && index < SCFiler2System.Instance.Option.HistoryView.ItemMaxNum; index++) {
112114 file.Save(viewName, "History" + index, historyList[index].FullName);
113115 }
114116 //読み込んだ数より少なかった場合は消す
Show on old repository browser