• R/O
  • SSH
  • HTTPS

tabtextfinder: Commit


Commit MetaInfo

Revision165 (tree)
Time2019-10-09 14:04:46
Authorneparze

Log Message

added exclude root folder option

Change Summary

Incremental Difference

--- Finder/FindQueryByPath.cs (revision 164)
+++ Finder/FindQueryByPath.cs (revision 165)
@@ -7,18 +7,21 @@
77 {
88 sealed class FindPathParam
99 {
10- public string Root { get; private set; }
10+ public string[] Roots { get; private set; }
11+ public string[] ExcludeRootPatterns { get; private set; }
1112 public string[] FilePatterns { get; private set; }
1213 public string[] ExcludeFilePatterns { get; private set; }
1314 public bool Recursive { get; private set; }
1415
15- private static char[] separators = new char[] { ' ' };
16+ private static char[] separators_root = new char[] { '|' };
17+ private static char[] separators_file = new char[] { ' ' };
1618
17- public FindPathParam( string root, string pattern, string exclude_pattern, bool recursive )
19+ public FindPathParam( string root, string exclude_root, string pattern, string exclude_pattern, bool recursive )
1820 {
19- Root = root;
20- FilePatterns = pattern.Split( separators );
21- ExcludeFilePatterns = exclude_pattern.Split( separators );
21+ Roots = root.Split( separators_root );
22+ ExcludeRootPatterns = exclude_root.Split( separators_root );
23+ FilePatterns = pattern.Split( separators_file );
24+ ExcludeFilePatterns = exclude_pattern.Split( separators_file );
2225 Recursive = recursive;
2326 }
2427 }
@@ -56,8 +59,6 @@
5659 {
5760 FileCache.Instance.IncrementGeneration();
5861
59- string[] roots = (param == null) ? new string[0]: param.Root.Split( new char[] { '|' } );
60-
6162 if (async) {
6263 int count = NumThreads;
6364 Action<int>[] actions = new Action<int>[count];
@@ -69,9 +70,7 @@
6970 handles[i] = ars[i].AsyncWaitHandle;
7071 }
7172
72- foreach (string root in roots) {
73- SearchDirectory( root );
74- }
73+ SearchDirectories();
7574 done_queueing = true;
7675
7776 while (!WaitHandle.WaitAll( handles, 50 )) {
@@ -81,9 +80,7 @@
8180 actions[i].EndInvoke( ars[i] );
8281 }
8382 } else {
84- foreach (string root in roots) {
85- SearchDirectory( root );
86- }
83+ SearchDirectories();
8784 ProcQueueSync( 0 );
8885 }
8986
@@ -115,6 +112,56 @@
115112 return files;
116113 }
117114
115+ private List<string> FindMatchedDirectories( string directory )
116+ {
117+ List<string> dirs = new List<string>();
118+ try {
119+ string[] _dirs = Directory.GetDirectories( directory );
120+ foreach (string dir in _dirs) {
121+ int idx = dirs.BinarySearch( dir );
122+ if (idx < 0) {
123+ dirs.Insert( ~idx, dir );
124+ }
125+ }
126+ }
127+ catch (Exception) {
128+ }
129+ return dirs;
130+ }
131+
132+ private List<string> FindMatchedDirectories( string directory, string[] patterns )
133+ {
134+ List<string> dirs = new List<string>();
135+ if (patterns != null) {
136+ foreach (string pattern in patterns) {
137+ if (Abort) { return dirs; }
138+ if (pattern.Length == 0) { continue; }
139+
140+ // find directories that match the wildcard patterns
141+ try {
142+ string[] _dirs = Directory.GetDirectories( directory, pattern );
143+ foreach (string dir in _dirs) {
144+ int idx = dirs.BinarySearch( dir );
145+ if (idx < 0) {
146+ dirs.Insert( ~idx, dir );
147+ }
148+ }
149+ }
150+ catch (Exception) {
151+ continue;
152+ }
153+ }
154+ }
155+ return dirs;
156+ }
157+
158+ private void SearchDirectories()
159+ {
160+ foreach (string root in param.Roots) {
161+ SearchDirectory( root );
162+ }
163+ }
164+
118165 private void SearchDirectory( string directory )
119166 {
120167 List<string> includes = FindMatchedFiles( directory, param.FilePatterns );
@@ -137,15 +184,18 @@
137184 if (param.Recursive) {
138185 if (Abort) { return; }
139186
140- string[] dirs = null;
141- try {
142- dirs = Directory.GetDirectories( directory );
187+ List<string> dir_includes = FindMatchedDirectories( directory );
188+ List<string> dir_excludes = FindMatchedDirectories( directory, param.ExcludeRootPatterns );
189+ if (Abort) { return; }
190+
191+ foreach (string dir_exclude in dir_excludes) {
192+ int idx = dir_includes.BinarySearch( dir_exclude );
193+ if (idx >= 0) {
194+ dir_includes.RemoveAt( idx );
195+ }
143196 }
144- catch (Exception) {
145- return;
146- }
147197
148- foreach (string dir in dirs) {
198+ foreach (string dir in dir_includes) {
149199 if (Abort) { return; }
150200 SearchDirectory( dir );
151201 }
--- Properties/Resources.Designer.cs (revision 164)
+++ Properties/Resources.Designer.cs (revision 165)
@@ -799,6 +799,15 @@
799799 }
800800
801801 /// <summary>
802+ /// Looks up a localized string similar to 検索から除外するフォルダ名およびワイルドカードパターン(再帰時のみ有効。基準フォルダからの相対パスの1階層分。パイプ&apos;|&apos;区切りで複数指定可能).
803+ /// </summary>
804+ internal static string ToolTip_ExcludeRoot {
805+ get {
806+ return ResourceManager.GetString("ToolTip_ExcludeRoot", resourceCulture);
807+ }
808+ }
809+
810+ /// <summary>
802811 /// Looks up a localized string similar to 検索するファイル名およびワイルドカードパターン(スペース区切りで複数指定可能).
803812 /// </summary>
804813 internal static string ToolTip_File {
--- Properties/Settings.Designer.cs (revision 164)
+++ Properties/Settings.Designer.cs (revision 165)
@@ -1,7 +1,7 @@
11 //------------------------------------------------------------------------------
22 // <auto-generated>
33 // This code was generated by a tool.
4-// Runtime Version:4.0.30319.34014
4+// Runtime Version:4.0.30319.42000
55 //
66 // Changes to this file may cause incorrect behavior and will be lost if
77 // the code is regenerated.
@@ -423,5 +423,16 @@
423423 this["RecentHistory"] = value;
424424 }
425425 }
426+
427+ [global::System.Configuration.UserScopedSettingAttribute()]
428+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
429+ public global::System.Collections.Specialized.StringCollection ComboExcludeRoots {
430+ get {
431+ return ((global::System.Collections.Specialized.StringCollection)(this["ComboExcludeRoots"]));
432+ }
433+ set {
434+ this["ComboExcludeRoots"] = value;
435+ }
436+ }
426437 }
427438 }
--- TabTextFinderForm.Designer.cs (revision 164)
+++ TabTextFinderForm.Designer.cs (revision 165)
@@ -28,11 +28,11 @@
2828 private void InitializeComponent()
2929 {
3030 this.components = new System.ComponentModel.Container();
31- this.split = new System.Windows.Forms.SplitContainer();
31+ this.splitFile = new System.Windows.Forms.SplitContainer();
3232 this.imgFile = new System.Windows.Forms.Label();
3333 this.labelFile = new System.Windows.Forms.Label();
3434 this.cmbFile = new TabTextFinder.UIControl.TextComboBox();
35- this.cmbExclude = new TabTextFinder.UIControl.TextComboBox();
35+ this.cmbExcludeFile = new TabTextFinder.UIControl.TextComboBox();
3636 this.labelExcludeFile = new System.Windows.Forms.Label();
3737 this.stripStatus = new System.Windows.Forms.StatusStrip();
3838 this.labelCase = new System.Windows.Forms.ToolStripStatusLabel();
@@ -65,41 +65,47 @@
6565 this.btnFindExcl = new System.Windows.Forms.Button();
6666 this.btnFindFound = new System.Windows.Forms.Button();
6767 this.cmbEncoding = new System.Windows.Forms.ComboBox();
68+ this.btnRecent = new System.Windows.Forms.Button();
69+ this.splitRoot = new System.Windows.Forms.SplitContainer();
70+ this.cmbRoot = new TabTextFinder.UIControl.TextComboBox();
71+ this.labelExcludeRoot = new System.Windows.Forms.Label();
72+ this.cmbExcludeRoot = new TabTextFinder.UIControl.TextComboBox();
6873 this.tabFinds = new TabTextFinder.UIControl.FindTabControl();
6974 this.tabHelp = new System.Windows.Forms.TabPage();
7075 this.richHelp = new System.Windows.Forms.RichTextBox();
7176 this.cmbText = new TabTextFinder.UIControl.TextComboBox();
72- this.cmbRoot = new TabTextFinder.UIControl.TextComboBox();
73- this.btnRecent = new System.Windows.Forms.Button();
74- this.split.Panel1.SuspendLayout();
75- this.split.Panel2.SuspendLayout();
76- this.split.SuspendLayout();
77+ this.splitFile.Panel1.SuspendLayout();
78+ this.splitFile.Panel2.SuspendLayout();
79+ this.splitFile.SuspendLayout();
7780 this.stripStatus.SuspendLayout();
81+ this.splitRoot.Panel1.SuspendLayout();
82+ this.splitRoot.Panel2.SuspendLayout();
83+ this.splitRoot.SuspendLayout();
7884 this.tabFinds.SuspendLayout();
7985 this.tabHelp.SuspendLayout();
8086 this.SuspendLayout();
8187 //
82- // split
88+ // splitFile
8389 //
84- this.split.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
90+ this.splitFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
8591 | System.Windows.Forms.AnchorStyles.Right)));
86- this.split.IsSplitterFixed = true;
87- this.split.Location = new System.Drawing.Point(0, 36);
88- this.split.Name = "split";
92+ this.splitFile.IsSplitterFixed = true;
93+ this.splitFile.Location = new System.Drawing.Point(0, 36);
94+ this.splitFile.Name = "splitFile";
8995 //
90- // split.Panel1
96+ // splitFile.Panel1
9197 //
92- this.split.Panel1.Controls.Add(this.imgFile);
93- this.split.Panel1.Controls.Add(this.labelFile);
94- this.split.Panel1.Controls.Add(this.cmbFile);
98+ this.splitFile.Panel1.Controls.Add(this.imgFile);
99+ this.splitFile.Panel1.Controls.Add(this.labelFile);
100+ this.splitFile.Panel1.Controls.Add(this.cmbFile);
95101 //
96- // split.Panel2
102+ // splitFile.Panel2
97103 //
98- this.split.Panel2.Controls.Add(this.cmbExclude);
99- this.split.Panel2.Controls.Add(this.labelExcludeFile);
100- this.split.Size = new System.Drawing.Size(360, 28);
101- this.split.SplitterDistance = 250;
102- this.split.TabIndex = 6;
104+ this.splitFile.Panel2.Controls.Add(this.cmbExcludeFile);
105+ this.splitFile.Panel2.Controls.Add(this.labelExcludeFile);
106+ this.splitFile.Size = new System.Drawing.Size(360, 28);
107+ this.splitFile.SplitterDistance = 250;
108+ this.splitFile.TabIndex = 6;
103109 //
104110 // imgFile
105111 //
@@ -131,16 +137,16 @@
131137 this.cmbFile.Size = new System.Drawing.Size(129, 26);
132138 this.cmbFile.TabIndex = 2;
133139 //
134- // cmbExclude
140+ // cmbExcludeFile
135141 //
136- this.cmbExclude.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
142+ this.cmbExcludeFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
137143 | System.Windows.Forms.AnchorStyles.Right)));
138- this.cmbExclude.FormattingEnabled = true;
139- this.cmbExclude.Location = new System.Drawing.Point(36, 0);
140- this.cmbExclude.MaxDropDownItems = 24;
141- this.cmbExclude.Name = "cmbExclude";
142- this.cmbExclude.Size = new System.Drawing.Size(70, 26);
143- this.cmbExclude.TabIndex = 1;
144+ this.cmbExcludeFile.FormattingEnabled = true;
145+ this.cmbExcludeFile.Location = new System.Drawing.Point(36, 0);
146+ this.cmbExcludeFile.MaxDropDownItems = 24;
147+ this.cmbExcludeFile.Name = "cmbExcludeFile";
148+ this.cmbExcludeFile.Size = new System.Drawing.Size(70, 26);
149+ this.cmbExcludeFile.TabIndex = 1;
144150 //
145151 // labelExcludeFile
146152 //
@@ -341,6 +347,7 @@
341347 this.chkRecursive.Text = "再帰";
342348 this.chkRecursive.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
343349 this.chkRecursive.UseVisualStyleBackColor = true;
350+ this.chkRecursive.CheckedChanged += new System.EventHandler(this.chkRecursive_changed);
344351 //
345352 // chkRegx
346353 //
@@ -410,9 +417,8 @@
410417 //
411418 // labelRoot
412419 //
413- this.labelRoot.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
414420 this.labelRoot.ImeMode = System.Windows.Forms.ImeMode.NoControl;
415- this.labelRoot.Location = new System.Drawing.Point(32, 8);
421+ this.labelRoot.Location = new System.Drawing.Point(32, 0);
416422 this.labelRoot.Name = "labelRoot";
417423 this.labelRoot.Size = new System.Drawing.Size(84, 24);
418424 this.labelRoot.TabIndex = 1;
@@ -423,7 +429,7 @@
423429 //
424430 this.imgRoot.Image = global::TabTextFinder.Properties.Resources.Img_folder__arrow;
425431 this.imgRoot.ImeMode = System.Windows.Forms.ImeMode.NoControl;
426- this.imgRoot.Location = new System.Drawing.Point(8, 8);
432+ this.imgRoot.Location = new System.Drawing.Point(8, 0);
427433 this.imgRoot.Name = "imgRoot";
428434 this.imgRoot.Size = new System.Drawing.Size(24, 24);
429435 this.imgRoot.TabIndex = 0;
@@ -499,6 +505,77 @@
499505 this.cmbEncoding.Size = new System.Drawing.Size(118, 26);
500506 this.cmbEncoding.TabIndex = 8;
501507 //
508+ // btnRecent
509+ //
510+ this.btnRecent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
511+ this.btnRecent.Image = global::TabTextFinder.Properties.Resources.Img_database;
512+ this.btnRecent.ImeMode = System.Windows.Forms.ImeMode.NoControl;
513+ this.btnRecent.Location = new System.Drawing.Point(424, 8);
514+ this.btnRecent.Name = "btnRecent";
515+ this.btnRecent.Size = new System.Drawing.Size(60, 28);
516+ this.btnRecent.TabIndex = 4;
517+ this.btnRecent.Text = "履歴";
518+ this.btnRecent.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
519+ this.btnRecent.UseVisualStyleBackColor = true;
520+ this.btnRecent.Click += new System.EventHandler(this.btnRecent_Click);
521+ //
522+ // splitRoot
523+ //
524+ this.splitRoot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
525+ | System.Windows.Forms.AnchorStyles.Right)));
526+ this.splitRoot.IsSplitterFixed = true;
527+ this.splitRoot.Location = new System.Drawing.Point(0, 8);
528+ this.splitRoot.Name = "splitRoot";
529+ //
530+ // splitRoot.Panel1
531+ //
532+ this.splitRoot.Panel1.Controls.Add(this.labelRoot);
533+ this.splitRoot.Panel1.Controls.Add(this.imgRoot);
534+ this.splitRoot.Panel1.Controls.Add(this.cmbRoot);
535+ //
536+ // splitRoot.Panel2
537+ //
538+ this.splitRoot.Panel2.Controls.Add(this.labelExcludeRoot);
539+ this.splitRoot.Panel2.Controls.Add(this.cmbExcludeRoot);
540+ this.splitRoot.Size = new System.Drawing.Size(360, 28);
541+ this.splitRoot.SplitterDistance = 250;
542+ this.splitRoot.TabIndex = 21;
543+ //
544+ // cmbRoot
545+ //
546+ this.cmbRoot.AllowDrop = true;
547+ this.cmbRoot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
548+ | System.Windows.Forms.AnchorStyles.Right)));
549+ this.cmbRoot.FormattingEnabled = true;
550+ this.cmbRoot.Location = new System.Drawing.Point(120, 0);
551+ this.cmbRoot.MaxDropDownItems = 24;
552+ this.cmbRoot.Name = "cmbRoot";
553+ this.cmbRoot.Size = new System.Drawing.Size(129, 26);
554+ this.cmbRoot.TabIndex = 2;
555+ this.cmbRoot.DragDrop += new System.Windows.Forms.DragEventHandler(this.cmbRoot_DragDrop);
556+ this.cmbRoot.DragEnter += new System.Windows.Forms.DragEventHandler(this.cmbRoot_DragEnter);
557+ //
558+ // labelExcludeRoot
559+ //
560+ this.labelExcludeRoot.ImeMode = System.Windows.Forms.ImeMode.NoControl;
561+ this.labelExcludeRoot.Location = new System.Drawing.Point(0, 0);
562+ this.labelExcludeRoot.Name = "labelExcludeRoot";
563+ this.labelExcludeRoot.Size = new System.Drawing.Size(36, 24);
564+ this.labelExcludeRoot.TabIndex = 1;
565+ this.labelExcludeRoot.Text = "除外";
566+ this.labelExcludeRoot.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
567+ //
568+ // cmbExcludeRoot
569+ //
570+ this.cmbExcludeRoot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
571+ | System.Windows.Forms.AnchorStyles.Right)));
572+ this.cmbExcludeRoot.FormattingEnabled = true;
573+ this.cmbExcludeRoot.Location = new System.Drawing.Point(36, 0);
574+ this.cmbExcludeRoot.MaxDropDownItems = 24;
575+ this.cmbExcludeRoot.Name = "cmbExcludeRoot";
576+ this.cmbExcludeRoot.Size = new System.Drawing.Size(70, 26);
577+ this.cmbExcludeRoot.TabIndex = 0;
578+ //
502579 // tabFinds
503580 //
504581 this.tabFinds.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -549,34 +626,6 @@
549626 this.cmbText.Size = new System.Drawing.Size(240, 26);
550627 this.cmbText.TabIndex = 11;
551628 //
552- // cmbRoot
553- //
554- this.cmbRoot.AllowDrop = true;
555- this.cmbRoot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
556- | System.Windows.Forms.AnchorStyles.Right)));
557- this.cmbRoot.FormattingEnabled = true;
558- this.cmbRoot.Location = new System.Drawing.Point(120, 8);
559- this.cmbRoot.MaxDropDownItems = 24;
560- this.cmbRoot.Name = "cmbRoot";
561- this.cmbRoot.Size = new System.Drawing.Size(240, 26);
562- this.cmbRoot.TabIndex = 2;
563- this.cmbRoot.DragDrop += new System.Windows.Forms.DragEventHandler(this.cmbRoot_DragDrop);
564- this.cmbRoot.DragEnter += new System.Windows.Forms.DragEventHandler(this.cmbRoot_DragEnter);
565- //
566- // btnRecent
567- //
568- this.btnRecent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
569- this.btnRecent.Image = global::TabTextFinder.Properties.Resources.Img_database;
570- this.btnRecent.ImeMode = System.Windows.Forms.ImeMode.NoControl;
571- this.btnRecent.Location = new System.Drawing.Point(424, 8);
572- this.btnRecent.Name = "btnRecent";
573- this.btnRecent.Size = new System.Drawing.Size(60, 28);
574- this.btnRecent.TabIndex = 4;
575- this.btnRecent.Text = "履歴";
576- this.btnRecent.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
577- this.btnRecent.UseVisualStyleBackColor = true;
578- this.btnRecent.Click += new System.EventHandler(this.btnRecent_Click);
579- //
580629 // TabTextFinderForm
581630 //
582631 this.AcceptButton = this.btnFind;
@@ -583,16 +632,16 @@
583632 this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 18F);
584633 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
585634 this.ClientSize = new System.Drawing.Size(624, 442);
635+ this.Controls.Add(this.splitRoot);
586636 this.Controls.Add(this.btnRecent);
587637 this.Controls.Add(this.cmbEncoding);
588638 this.Controls.Add(this.btnFindFound);
589639 this.Controls.Add(this.btnFindExcl);
590640 this.Controls.Add(this.btnFindIncl);
591- this.Controls.Add(this.split);
641+ this.Controls.Add(this.splitFile);
592642 this.Controls.Add(this.btnConfig);
593643 this.Controls.Add(this.chkWord);
594644 this.Controls.Add(this.imgText);
595- this.Controls.Add(this.imgRoot);
596645 this.Controls.Add(this.chkRegx);
597646 this.Controls.Add(this.chkCase);
598647 this.Controls.Add(this.chkRecursive);
@@ -601,8 +650,6 @@
601650 this.Controls.Add(this.btnFind);
602651 this.Controls.Add(this.cmbText);
603652 this.Controls.Add(this.labelText);
604- this.Controls.Add(this.labelRoot);
605- this.Controls.Add(this.cmbRoot);
606653 this.Controls.Add(this.stripStatus);
607654 this.DoubleBuffered = true;
608655 this.Font = new System.Drawing.Font("Meiryo", 9F);
@@ -613,11 +660,14 @@
613660 this.Activated += new System.EventHandler(this.MainForm_Activated);
614661 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
615662 this.Load += new System.EventHandler(this.MainForm_Load);
616- this.split.Panel1.ResumeLayout(false);
617- this.split.Panel2.ResumeLayout(false);
618- this.split.ResumeLayout(false);
663+ this.splitFile.Panel1.ResumeLayout(false);
664+ this.splitFile.Panel2.ResumeLayout(false);
665+ this.splitFile.ResumeLayout(false);
619666 this.stripStatus.ResumeLayout(false);
620667 this.stripStatus.PerformLayout();
668+ this.splitRoot.Panel1.ResumeLayout(false);
669+ this.splitRoot.Panel2.ResumeLayout(false);
670+ this.splitRoot.ResumeLayout(false);
621671 this.tabFinds.ResumeLayout(false);
622672 this.tabHelp.ResumeLayout(false);
623673 this.ResumeLayout(false);
@@ -663,13 +713,16 @@
663713 private System.Windows.Forms.ToolStripStatusLabel labelRegx;
664714 private System.Windows.Forms.Button btnConfig;
665715 private System.Windows.Forms.Label labelExcludeFile;
666- private TabTextFinder.UIControl.TextComboBox cmbExclude;
667- private System.Windows.Forms.SplitContainer split;
716+ private TabTextFinder.UIControl.TextComboBox cmbExcludeFile;
717+ private System.Windows.Forms.SplitContainer splitFile;
668718 private System.Windows.Forms.Button btnFindIncl;
669719 private System.Windows.Forms.Button btnFindExcl;
670720 private System.Windows.Forms.Button btnFindFound;
671721 private System.Windows.Forms.ComboBox cmbEncoding;
672722 private System.Windows.Forms.Button btnRecent;
723+ private System.Windows.Forms.SplitContainer splitRoot;
724+ private TabTextFinder.UIControl.TextComboBox cmbExcludeRoot;
725+ private System.Windows.Forms.Label labelExcludeRoot;
673726
674727 }
675728 }
--- TabTextFinderForm.cs (revision 164)
+++ TabTextFinderForm.cs (revision 165)
@@ -86,7 +86,8 @@
8686 setToolTip( cmbRoot, Resources.ToolTip_Root );
8787 setToolTip( cmbFile, Resources.ToolTip_File );
8888 setToolTip( cmbText, Resources.ToolTip_Text );
89- setToolTip( cmbExclude, Resources.ToolTip_ExcludeFile );
89+ setToolTip( cmbExcludeRoot, Resources.ToolTip_ExcludeRoot );
90+ setToolTip( cmbExcludeFile, Resources.ToolTip_ExcludeFile );
9091 setToolTip( cmbEncoding, Resources.ToolTip_Encoding );
9192
9293 setToolTip( chkCase, Resources.ToolTip_Case );
@@ -164,7 +165,8 @@
164165 cmbRoot.TextItems = settings.ComboRoots;
165166 cmbFile.TextItems = settings.ComboFiles;
166167 cmbText.TextItems = settings.ComboTexts;
167- cmbExclude.TextItems = settings.ComboExcludeFiles;
168+ cmbExcludeRoot.TextItems = settings.ComboExcludeRoots;
169+ cmbExcludeFile.TextItems = settings.ComboExcludeFiles;
168170 FileEncoding = settings.FileEncoding;
169171 //
170172 if (InitRoot != null) cmbRoot.Text = InitRoot;
@@ -190,6 +192,8 @@
190192 chkRegx.DataBindings.Add( "Checked", settings, "CheckRegx" );
191193 chkRecursive.DataBindings.Add( "Checked", settings, "CheckRecursive" );
192194
195+ cmbExcludeRoot.Enabled = chkRecursive.Checked;
196+
193197 FileCache.Instance.SetPolicy( settings.CheckFileCache, settings.SizeFileCache );
194198 }
195199
@@ -200,7 +204,8 @@
200204 settings.ComboRoots = cmbRoot.TextItems;
201205 settings.ComboFiles = cmbFile.TextItems;
202206 settings.ComboTexts = cmbText.TextItems;
203- settings.ComboExcludeFiles = cmbExclude.TextItems;
207+ settings.ComboExcludeRoots = cmbExcludeRoot.TextItems;
208+ settings.ComboExcludeFiles = cmbExcludeFile.TextItems;
204209 settings.FileEncoding = FileEncoding;
205210 }
206211 {// recent items
@@ -221,7 +226,9 @@
221226 if (recent == null) { return; }
222227 cmbRoot.Text = recent.Root;
223228 cmbFile.Text = recent.File;
224- cmbExclude.Text = recent.Exclude;
229+ cmbExcludeRoot.Text = recent.ExcludeRoot;
230+ cmbExcludeFile.Text = recent.Exclude;
231+ chkRecursive.Checked = recent.Recursive;
225232 }
226233
227234 private void menuRecent_Closed( object sender, ToolStripDropDownClosedEventArgs e )
@@ -244,7 +251,26 @@
244251 {
245252 for (int n = recent_items.Count - 1; n >= 0; --n) {
246253 RecentItem recent = recent_items[n];
247- string text = string.Format( "[ {0} ] + [ {1} ] - [ {2} ]", recent.Root, recent.File, recent.Exclude );
254+ string str;
255+ str = recent.Root;
256+ if (string.IsNullOrEmpty( str ) == false) { str.Trim(); }
257+ string text = string.Format( "[ {0}", str );
258+ //
259+ str = recent.ExcludeRoot;
260+ if (string.IsNullOrEmpty( str ) == false) { str.Trim(); }
261+ if (string.IsNullOrEmpty( str ) == false) { text += string.Format( " - {0}", str ); }
262+ //
263+ text += " ] ";
264+ text += (recent.Recursive) ? "//" : "/";
265+ //
266+ str = recent.File;
267+ if (string.IsNullOrEmpty( str ) == false) { str.Trim(); }
268+ text += string.Format( " [ {0}", str );
269+ //
270+ str = recent.Exclude;
271+ if (string.IsNullOrEmpty( str ) == false) { str.Trim(); }
272+ if (string.IsNullOrEmpty( str ) == false) { text += string.Format( " - {0}", str ); }
273+ text += " ]";
248274 ToolStripItem item = recent_menu.Items.Add( text );
249275 item.Tag = recent;
250276 }
@@ -253,6 +279,11 @@
253279 recent_menu.Show( this, btn.Location.X, btn.Location.Y + btn.Height );
254280 }
255281
282+ private void chkRecursive_changed( object sender, EventArgs e )
283+ {
284+ cmbExcludeRoot.Enabled = chkRecursive.Checked;
285+ }
286+
256287 private void btnConfig_Click( object sender, EventArgs e )
257288 {
258289 using (ConfigForm form = new ConfigForm()) {
@@ -326,12 +357,14 @@
326357 text = StringUtil.GetFirstLine( text );
327358 if (string.IsNullOrEmpty( text )) { return; }
328359 }
360+ RecentItem recent = new RecentItem() { Root = cmbRoot.Text, File = cmbFile.Text, ExcludeRoot = cmbExcludeRoot.Text, Exclude = cmbExcludeFile.Text, Recursive = chkRecursive.Checked };
329361 {// save combo-box values
330362 cmbText.AddTextToItems( text );
331363 cmbRoot.AddTextToItems();
332364 cmbFile.AddTextToItems();
333- cmbExclude.AddTextToItems();
334- recent_items.AddItem( new RecentItem() { Root = cmbRoot.Text, File = cmbFile.Text, Exclude = cmbExclude.Text } );
365+ cmbExcludeRoot.AddTextToItems();
366+ cmbExcludeFile.AddTextToItems();
367+ recent_items.AddItem( recent );
335368 btnRecent.Enabled = (recent_items.Count > 0);
336369 SaveSettings();
337370 }
@@ -348,7 +381,7 @@
348381 Settings settings = Settings.Default;
349382 FoundLineOption line_option = new FoundLineOption( settings.ListPathFullName, settings.ListPreviewMaxCharsLeft, settings.ListPreviewMaxCharsRight );
350383 if (type == FindType.NewPath) {
351- FindPathParam param = new FindPathParam( cmbRoot.Text, cmbFile.Text, cmbExclude.Text, chkRecursive.Checked );
384+ FindPathParam param = new FindPathParam( recent.Root, (recent.Recursive) ? recent.ExcludeRoot : string.Empty, recent.File, recent.Exclude, recent.Recursive );
352385 query = new FindQueryByPath( type, line_option, finder, finder, FileEncoding, param );
353386 } else if (type == FindType.FoundPath) {
354387 if (base_query == null) { return; }
@@ -594,13 +627,26 @@
594627 {
595628 public string Root { get; set; }
596629 public string File { get; set; }
630+ public string ExcludeRoot { get; set; }
597631 public string Exclude { get; set; }
632+ public bool Recursive { get; set; }
598633
634+ public RecentItem()
635+ {
636+ Root = "";
637+ File = "";
638+ ExcludeRoot = "";
639+ Exclude = "";
640+ Recursive = true;
641+ }
642+
599643 public bool Equals( RecentItem other )
600644 {
601645 if (Root != other.Root) return false;
602646 if (File != other.File) return false;
647+ if (ExcludeRoot != other.ExcludeRoot) return false;
603648 if (Exclude != other.Exclude) return false;
649+ if (Recursive != other.Recursive) return false;
604650 return true;
605651 }
606652 }
Show on old repository browser