~ubuntu-branches/ubuntu/vivid/lazarus/vivid

« back to all changes in this revision

Viewing changes to components/PascalScript/Samples/IDE/dlgSearchText.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Paul Gevers
  • Date: 2014-02-22 10:25:57 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140222102557-ors9d31r84nz31jq
Tags: 1.2~rc2+dfsg-1
[ Abou Al Montacir ]
* New upstream pre-release.
  + Moved ideintf to components directory.
  + Added new package cairocanvas.
* Remove usage of depreciated parameters form of find. (Closes: Bug#724776)
* Bumped standard version to 3.9.5.
* Clean the way handling make files generation and removal.

[ Paul Gevers ]
* Remove nearly obsolete bzip compression for binary packages
  (See https://lists.debian.org/debian-devel/2014/01/msg00542.html)
* Update d/copyright for newly added dir in examples and components
* Update Vcs-* fields with new packaging location
* Update d/watch file to properly (Debian way) change upstreams versions
* Prevent 46MB of package size by sym linking duplicate files
* Patches
  - refresh to remove fuzz
  - add more Lintian found spelling errors
  - new patch to add shbang to two scripts in lazarus-src
* Drop lcl-# from Provides list of lcl-units-#
* Make lazarus-ide-qt4-# an arch all until it really contains stuff
* Make all metapackages arch all as the usecase for arch any doesn't
  seem to warrant the addition archive hit
* Fix permissions of non-scripts in lazarus-src-#

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{-------------------------------------------------------------------------------
 
2
The contents of this file are subject to the Mozilla Public License
 
3
Version 1.1 (the "License"); you may not use this file except in compliance
 
4
with the License. You may obtain a copy of the License at
 
5
http://www.mozilla.org/MPL/
 
6
 
 
7
Software distributed under the License is distributed on an "AS IS" basis,
 
8
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 
9
the specific language governing rights and limitations under the License.
 
10
 
 
11
The Original Code is: dlgSearchText.pas, released 2000-06-23.
 
12
 
 
13
The Original Code is part of the SearchReplaceDemo project, written by
 
14
Michael Hieke for the SynEdit component suite.
 
15
All Rights Reserved.
 
16
 
 
17
Contributors to the SynEdit project are listed in the Contributors.txt file.
 
18
 
 
19
Alternatively, the contents of this file may be used under the terms of the
 
20
GNU General Public License Version 2 or later (the "GPL"), in which case
 
21
the provisions of the GPL are applicable instead of those above.
 
22
If you wish to allow use of your version of this file only under the terms
 
23
of the GPL and not to allow others to use your version of this file
 
24
under the MPL, indicate your decision by deleting the provisions above and
 
25
replace them with the notice and other provisions required by the GPL.
 
26
If you do not delete the provisions above, a recipient may use your version
 
27
of this file under either the MPL or the GPL.
 
28
 
 
29
$Id: dlgSearchText.pas,v 1.3 2002/08/01 05:44:05 etrusco Exp $
 
30
 
 
31
You may retrieve the latest version of this file at the SynEdit home page,
 
32
located at http://SynEdit.SourceForge.net
 
33
 
 
34
Known Issues:
 
35
-------------------------------------------------------------------------------}
 
36
 
 
37
unit dlgSearchText;
 
38
 
 
39
{$I SynEdit.inc}
 
40
 
 
41
interface
 
42
 
 
43
uses
 
44
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 
45
  StdCtrls, ExtCtrls;
 
46
 
 
47
type
 
48
  TTextSearchDialog = class(TForm)
 
49
    Label1: TLabel;
 
50
    cbSearchText: TComboBox;
 
51
    rgSearchDirection: TRadioGroup;
 
52
    gbSearchOptions: TGroupBox;
 
53
    cbSearchCaseSensitive: TCheckBox;
 
54
    cbSearchWholeWords: TCheckBox;
 
55
    cbSearchFromCursor: TCheckBox;
 
56
    cbSearchSelectedOnly: TCheckBox;
 
57
    btnOK: TButton;
 
58
    btnCancel: TButton;
 
59
    cbRegularExpression: TCheckBox;
 
60
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
 
61
  private
 
62
    function GetSearchBackwards: boolean;
 
63
    function GetSearchCaseSensitive: boolean;
 
64
    function GetSearchFromCursor: boolean;
 
65
    function GetSearchInSelection: boolean;
 
66
    function GetSearchText: string;
 
67
    function GetSearchTextHistory: string;
 
68
    function GetSearchWholeWords: boolean;
 
69
    procedure SetSearchBackwards(Value: boolean);
 
70
    procedure SetSearchCaseSensitive(Value: boolean);
 
71
    procedure SetSearchFromCursor(Value: boolean);
 
72
    procedure SetSearchInSelection(Value: boolean);
 
73
    procedure SetSearchText(Value: string);
 
74
    procedure SetSearchTextHistory(Value: string);
 
75
    procedure SetSearchWholeWords(Value: boolean);
 
76
    procedure SetSearchRegularExpression(const Value: boolean);
 
77
    function GetSearchRegularExpression: boolean;
 
78
  public
 
79
    property SearchBackwards: boolean read GetSearchBackwards
 
80
      write SetSearchBackwards;
 
81
    property SearchCaseSensitive: boolean read GetSearchCaseSensitive
 
82
      write SetSearchCaseSensitive;
 
83
    property SearchFromCursor: boolean read GetSearchFromCursor
 
84
      write SetSearchFromCursor;
 
85
    property SearchInSelectionOnly: boolean read GetSearchInSelection
 
86
      write SetSearchInSelection;
 
87
    property SearchText: string read GetSearchText write SetSearchText;
 
88
    property SearchTextHistory: string read GetSearchTextHistory
 
89
      write SetSearchTextHistory;
 
90
    property SearchWholeWords: boolean read GetSearchWholeWords
 
91
      write SetSearchWholeWords;
 
92
    property SearchRegularExpression: boolean read GetSearchRegularExpression
 
93
      write SetSearchRegularExpression;
 
94
  end;
 
95
 
 
96
implementation
 
97
 
 
98
{$R *.DFM}
 
99
 
 
100
{ TTextSearchDialog }
 
101
 
 
102
function TTextSearchDialog.GetSearchBackwards: boolean;
 
103
begin
 
104
  Result := rgSearchDirection.ItemIndex = 1;
 
105
end;
 
106
 
 
107
function TTextSearchDialog.GetSearchCaseSensitive: boolean;
 
108
begin
 
109
  Result := cbSearchCaseSensitive.Checked;
 
110
end;
 
111
 
 
112
function TTextSearchDialog.GetSearchFromCursor: boolean;
 
113
begin
 
114
  Result := cbSearchFromCursor.Checked;
 
115
end;
 
116
 
 
117
function TTextSearchDialog.GetSearchInSelection: boolean;
 
118
begin
 
119
  Result := cbSearchSelectedOnly.Checked;
 
120
end;
 
121
 
 
122
function TTextSearchDialog.GetSearchRegularExpression: boolean;
 
123
begin
 
124
  Result := cbRegularExpression.Checked;
 
125
end;
 
126
 
 
127
function TTextSearchDialog.GetSearchText: string;
 
128
begin
 
129
  Result := cbSearchText.Text;
 
130
end;
 
131
 
 
132
function TTextSearchDialog.GetSearchTextHistory: string;
 
133
var
 
134
  i: integer;
 
135
begin
 
136
  Result := '';
 
137
  for i := 0 to cbSearchText.Items.Count - 1 do begin
 
138
    if i >= 10 then
 
139
      break;
 
140
    if i > 0 then
 
141
      Result := Result + #13#10;
 
142
    Result := Result + cbSearchText.Items[i];
 
143
  end;
 
144
end;
 
145
 
 
146
function TTextSearchDialog.GetSearchWholeWords: boolean;
 
147
begin
 
148
  Result := cbSearchWholeWords.Checked;
 
149
end;
 
150
 
 
151
procedure TTextSearchDialog.SetSearchBackwards(Value: boolean);
 
152
begin
 
153
  rgSearchDirection.ItemIndex := Ord(Value);
 
154
end;
 
155
 
 
156
procedure TTextSearchDialog.SetSearchCaseSensitive(Value: boolean);
 
157
begin
 
158
  cbSearchCaseSensitive.Checked := Value;
 
159
end;
 
160
 
 
161
procedure TTextSearchDialog.SetSearchFromCursor(Value: boolean);
 
162
begin
 
163
  cbSearchFromCursor.Checked := Value;
 
164
end;
 
165
 
 
166
procedure TTextSearchDialog.SetSearchInSelection(Value: boolean);
 
167
begin
 
168
  cbSearchSelectedOnly.Checked := Value;
 
169
end;
 
170
 
 
171
procedure TTextSearchDialog.SetSearchText(Value: string);
 
172
begin
 
173
  cbSearchText.Text := Value;
 
174
end;
 
175
 
 
176
procedure TTextSearchDialog.SetSearchTextHistory(Value: string);
 
177
begin
 
178
  cbSearchText.Items.Text := Value;
 
179
end;
 
180
 
 
181
procedure TTextSearchDialog.SetSearchWholeWords(Value: boolean);
 
182
begin
 
183
  cbSearchWholeWords.Checked := Value;
 
184
end;
 
185
 
 
186
procedure TTextSearchDialog.SetSearchRegularExpression(
 
187
  const Value: boolean);
 
188
begin
 
189
  cbRegularExpression.Checked := Value;
 
190
end;
 
191
 
 
192
{ event handlers }
 
193
 
 
194
procedure TTextSearchDialog.FormCloseQuery(Sender: TObject;
 
195
  var CanClose: Boolean);
 
196
var
 
197
  s: string;
 
198
  i: integer;
 
199
begin
 
200
  if ModalResult = mrOK then begin
 
201
    s := cbSearchText.Text;
 
202
    if s <> '' then begin
 
203
      i := cbSearchText.Items.IndexOf(s);
 
204
      if i > -1 then begin
 
205
        cbSearchText.Items.Delete(i);
 
206
        cbSearchText.Items.Insert(0, s);
 
207
        cbSearchText.Text := s;
 
208
      end else
 
209
        cbSearchText.Items.Insert(0, s);
 
210
    end;
 
211
  end;
 
212
end;
 
213
 
 
214
end.
 
215
 
 
216
 
 
 
b'\\ No newline at end of file'