/
FindTab.cs
169 lines (143 loc) · 4.95 KB
/
FindTab.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/* ====================================================================
Copyright (C) 2004-2008 fyiReporting Software, LLC
Copyright (C) 2011 Peter Gill <peter@majorsilence.com>
This file is part of the fyiReporting RDL project.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For additional information, email info@fyireporting.com or visit
the website www.fyiReporting.com.
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using fyiReporting.RdlDesign.Resources;
namespace fyiReporting.RdlDesign
{
/// <summary>
/// Summary description for FindTab.
/// </summary>
internal partial class FindTab
{
public FindTab()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.AcceptButton = btnNext;
this.CancelButton = btnCancel;
txtFind.Focus();
}
internal FindTab(RdlEditPreview pad)
{
rdlEdit = pad;
rdlEdit.FindTab = this;
InitializeComponent();
this.AcceptButton = btnNext;
this.CancelButton = btnCancel;
txtFind.Focus();
}
private void btnNext_Click(object sender, System.EventArgs e)
{
rdlEdit.FindNext(this, txtFind.Text, chkCase.Checked, radioUp.Checked);
}
private void txtFind_TextChanged(object sender, System.EventArgs e)
{
if (txtFind.Text == "")
btnNext.Enabled = false;
else
btnNext.Enabled = true;
}
private void btnFindNext_Click(object sender, System.EventArgs e)
{
rdlEdit.FindNext(this, txtFindR.Text, chkMatchCase.Checked, false);
txtFind.Focus();
}
private void btnReplace_Click(object sender, System.EventArgs e)
{
rdlEdit.ReplaceNext(this, txtFindR.Text, txtReplace.Text, chkCase.Checked);
txtFindR.Focus();
}
private void txtFindR_TextChanged(object sender, System.EventArgs e)
{
bool bEnable = (txtFindR.Text == "") ? false : true;
btnFindNext.Enabled = bEnable;
btnReplace.Enabled = bEnable;
btnReplaceAll.Enabled = bEnable;
}
private void btnReplaceAll_Click(object sender, System.EventArgs e)
{
rdlEdit.ReplaceAll(this, txtFindR.Text, txtReplace.Text, chkMatchCase.Checked);
txtFindR.Focus();
}
private void btnGoto_Click(object sender, System.EventArgs e)
{
try
{
try
{
int nLine = Int32.Parse(txtLine.Text);
rdlEdit.Goto(this, nLine);
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message, Strings.FindTab_ShowE_InvalidLN);
}
txtLine.Focus();
}
catch (Exception er)
{
er.ToString();
}
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
Close();
}
private void tcFRG_SelectedIndexChanged(object sender, System.EventArgs e)
{
TabControl tc = (TabControl)sender;
string tag = (string)tc.TabPages[tc.SelectedIndex].Tag;
switch (tag)
{
case "find":
this.AcceptButton = btnNext;
this.CancelButton = btnCancel;
txtFind.Focus();
break;
case "replace":
this.AcceptButton = this.btnFindNext;
this.CancelButton = this.bCloseReplace;
txtFindR.Focus();
break;
case "goto":
this.AcceptButton = btnGoto;
this.CancelButton = this.bCloseGoto;
txtLine.Focus();
break;
}
}
private void tcFRG_Enter(object sender, System.EventArgs e)
{
tcFRG_SelectedIndexChanged(this.tcFRG, new EventArgs());
}
private void FindTab_FormClosed(object sender, FormClosedEventArgs e)
{
rdlEdit.ClearSearchHighlight();
}
public void FindNextClick()
{
if (!String.IsNullOrEmpty(txtFind.Text))
btnNext.PerformClick();
}
}
}