source: trunk/NewView/GlobalSearchForm.pas

Last change on this file was 472, checked in by ataylor, 3 years ago

Fix various outstanding problems with dialog layout & scaling.

  • Property svn:eol-style set to native
File size: 20.2 KB
Line 
1Unit GlobalSearchForm;
2
3// NewView - a new OS/2 Help Viewer
4// Copyright 2003 Aaron Lawrence (aaronl at consultant dot com)
5// This software is released under the Gnu Public License - see readme.txt
6
7Interface
8
9// Global search uses a thread to load helpfiles, search them, and
10// send the results to be displayed.
11
12Uses
13 PmWin,
14 Classes,
15 Forms,
16 Buttons,
17 StdCtrls,
18 ComCtrls,
19 Outline2,
20 GenericThread,
21 ACLLanguageUnit,
22 TextSearchQuery,
23 HelpFile,
24 ExtCtrls,
25 LED;
26
27const
28 // Custom window messages for this form
29 // NOTE! Sibyl uses WM_USER+1 and +2!
30 WM_OPENED = WM_USER + 10;
31
32Type
33 TViewTopicCallback = procedure( Filename: string;
34 TopicIndex: longint ) of object;
35
36 TSearchParameters = class
37 Query: TTextSearchQuery;
38 Directories: TStringList;
39 end;
40
41 // Returned by thread. (Note - helpfiles and topics are destroyed dynamically.)
42 TSearchResult = class
43 Filename: string;
44 FileTitle: string;
45 MatchingTopics: TList;
46 constructor Create;
47 destructor Destroy; override;
48 end;
49
50 TGlobalSearchForm = Class (TForm)
51 SearchTextEdit: TEdit;
52 SearchTextLabel: TLabel;
53 SelectDrivesButton: TButton;
54 SearchTextLabel1: TLabel;
55 ResultsLabel: TLabel;
56 Led: TLed;
57 LEDTimer: TTimer;
58 SearchLocationComboBox: TComboBox;
59 Bevel: TBevel;
60 HelpButton: TButton;
61 ResultsOutline: TOutline2;
62 SearchButton: TButton;
63 ViewTopicButton: TButton;
64 CancelButton: TButton;
65 ProgressBar: TProgressBar;
66 ProgressLabel: TLabel;
67 Procedure SearchLocationComboBoxOnItemSelect (Sender: TObject;
68 Index: LongInt);
69 Procedure LEDTimerOnTimer (Sender: TObject);
70 Procedure SearchInComboBoxOnChange (Sender: TObject);
71 Procedure ResultsOutlineOnEnter (Sender: TObject);
72 Procedure SearchTextEditOnEnter (Sender: TObject);
73 Procedure SelectDrivesButtonOnClick (Sender: TObject);
74 Procedure GlobalSearchFormOnSetupShow (Sender: TObject);
75 Procedure CancelButtonOnClick (Sender: TObject);
76 Procedure GlobalSearchFormOnClose (Sender: TObject;
77 Var Action: TCloseAction);
78 Procedure ResultsOutlineOnItemDblClick (Node: TNode);
79 Procedure ViewTopicButtonOnClick (Sender: TObject);
80 Procedure GlobalSearchFormOnCreate (Sender: TObject);
81 Procedure GlobalSearchFormOnCloseQuery (Sender: TObject;
82 Var CanClose: Boolean);
83 Procedure SearchButtonOnClick (Sender: TObject);
84 Procedure GlobalSearchFormOnShow (Sender: TObject);
85 Protected
86 Procedure OnSearchProgress ( n, outof: integer;
87 S: String );
88 Procedure OnMatchFound( SearchResult: TSearchResult );
89 Procedure OnThreadData( S: string; Data: TObject );
90 Procedure OnSearchFinished( Result: TObject );
91 Procedure SetProgressLabel( const S: String );
92
93 // Handle our own WM_OPENED message
94 Procedure WMOpened( Var Msg: TMessage ); Message WM_OPENED;
95 Procedure ClearResults;
96 Procedure ViewTopic;
97
98 ThreadManager: TGenericThreadManager;
99
100 Procedure UpdateButtons;
101
102
103 Procedure GetSelectedDirectories( List: TStringList );
104
105 // search thread context
106
107 Function Search( Parameters: TObject ): TObject;
108
109 protected
110 Procedure OnLanguageEvent( Language: TLanguageFile; const Apply: boolean );
111
112 SearchCaption: string;
113 StopCaption: string;
114 NoResultsMsg: string;
115 ScanDirectoriesMsg: string;
116 SearchingFileMsg: string;
117 OfMsg: string;
118 DoneMsg: string;
119 SearchErrorTitle: string;
120 SearchError: string;
121
122 StandardHelpPathsLocation: string;
123 FixedDrivesLocation: string;
124 SelectedHelpPathsLocation: string;
125 CustomPathsLocation: string;
126
127 public
128 // set by caller
129 ViewTopicCallback: TViewTopicCallback;
130 Procedure DoSearch;
131 End;
132
133Var
134 GlobalSearchForm: TGlobalSearchForm;
135
136procedure EnsureGlobalSearchFormLoaded;
137
138Implementation
139
140uses
141 SysUtils,
142 DebugUnit,
143 ACLDialogs,
144 ControlsUtility,
145 DriveInfoUnit,
146 IPFFileFormatUnit,
147 HelpTopic,
148 SearchUnit,
149 SearchDirectoriesFormUnit,
150 SettingsUnit,
151 InformationFormUnit,
152 StringUtilsUnit,
153 FileUtilsUnit;
154
155type
156 // Used to store filenames in outline
157 THelpFileInfo = class
158 FileName: string;
159 end;
160
161constructor TSearchResult.Create;
162begin
163 inherited Create;
164 MatchingTopics := TList.Create;
165end;
166
167destructor TSearchResult.Destroy;
168begin
169 MatchingTopics.Destroy;
170 inherited Destroy;
171end;
172
173Procedure TGlobalSearchForm.SearchLocationComboBoxOnItemSelect (Sender: TObject; Index: LongInt);
174Begin
175 Settings.GlobalSearchLocation := TGlobalSearchLocation( SearchLocationComboBox.ItemIndex );
176End;
177
178Procedure TGlobalSearchForm.LEDTimerOnTimer (Sender: TObject);
179Begin
180 LED.LedCondition := not LED.LedCondition;
181End;
182
183Procedure TGlobalSearchForm.SearchInComboBoxOnChange (Sender: TObject);
184Begin
185End;
186
187Procedure TGlobalSearchForm.ResultsOutlineOnEnter (Sender: TObject);
188Begin
189 ViewTopicButton.Default := true;
190End;
191
192Procedure TGlobalSearchForm.SearchTextEditOnEnter (Sender: TObject);
193Begin
194 SearchButton.Default := true;
195End;
196
197
198Procedure TGlobalSearchForm.GetSelectedDirectories(List: TStringList);
199Var
200 tmpDirectories : TStringList;
201
202 DriveNumber: longint;
203 DriveType: TDriveType;
204 DriveLetter: char;
205 i: longint;
206 Dir: string;
207 FoundIndex: longint;
208begin
209 List.Clear;
210 case SearchLocationComboBox.ItemIndex of
211 -1:
212 begin
213 // one custom dir...
214 List.Add( SearchLocationComboBox.Text );
215 end;
216
217 Ord( gsHelpPaths ),
218 Ord( gsSelectedHelpPaths ): // standard or selected help paths
219 Begin
220 tmpDirectories := TStringList.Create;
221 List.Sorted := true;
222 List.Duplicates := dupIgnore;
223
224 // GetDirsInPath clears the list tmpDirectories
225 GetDirsInPath(HelpPathEnvironmentVar, tmpDirectories);
226 List.AddStrings(tmpDirectories);
227
228 GetDirsInPath(BookshelfEnvironmentVar, tmpDirectories);
229 List.AddStrings(tmpDirectories);
230
231 tmpDirectories.Destroy;
232
233 // for selected paths we have to adjust the selection
234 if SearchLocationComboBox.ItemIndex = Ord( gsSelectedHelpPaths ) then
235 begin
236 // now mark some as non-selected...
237 for i := 0 to List.Count - 1 do
238 begin
239 Dir := List[i];
240 if not Settings.SearchDirectories.Find( Dir, FoundIndex ) then
241 List.Objects[i] := pointer(1);
242 end;
243 end;
244 end;
245
246
247 Ord( gsFixedDrives ):
248 begin
249 // drives
250 For DriveNumber := MinDriveNumber To MaxDriveNumber Do
251 Begin
252 DriveType := GetDriveType( DriveNumber );
253 DriveLetter := Chr( DriveNumber + Ord( 'A' ) - 1 );
254
255 if DriveType = dtHard then
256 begin
257 List.Add( DriveLetter + ':\...' );
258 end;
259 end;
260 end;
261
262 Ord( gsCustom ):
263 begin
264 // already custom...
265 List.Assign(Settings.SearchDirectories);
266 end;
267 end;
268end;
269
270Procedure TGlobalSearchForm.SelectDrivesButtonOnClick (Sender: TObject);
271begin
272 GetSelectedDirectories(SearchDirectoriesForm.SelectedFolders);
273
274 SearchDirectoriesForm.ShowModal;
275 if SearchDirectoriesForm.ModalResult <> mrOK then
276 exit;
277
278 // there was a selection, so we have to change the dropdown
279 if SearchLocationComboBox.ItemIndex = Ord( gsHelpPaths ) then
280 SearchLocationComboBox.ItemIndex := Ord( gsSelectedHelpPaths );
281
282 if SearchLocationComboBox.ItemIndex = Ord( gsFixedDrives ) then
283 SearchLocationComboBox.ItemIndex := Ord( gsCustom );
284
285 if SearchDirectoriesForm.CustomDirAdded then
286 SearchLocationComboBox.ItemIndex := Ord( gsCustom );
287
288 // update the settings
289 Settings.SearchDirectories.Assign( SearchDirectoriesForm.SelectedFolders );
290 SaveSettings;
291End;
292
293Procedure TGlobalSearchForm.UpdateButtons;
294Begin
295 // HelpPathsRadioButton.Checked := SearchType = stHelpPaths;
296 // EverywhereRadioButton.Checked := SearchType = stDrives;
297// FolderRadioButton.Checked := SearchType = stFolder;
298
299End;
300
301Procedure TGlobalSearchForm.GlobalSearchFormOnSetupShow (Sender: TObject);
302Begin
303 ScaleForm( self, 9, 16 );
304
305 // Fix scaling issues on some controls
306 SearchLocationComboBox.Top := SelectDrivesButton.Top + 3;
307 SearchTextLabel1.Top := SelectDrivesButton.Top + 5;
308 Bevel.Bottom := ClientHeight - ResultsLabel.Top + 4;
309 Led.Height := 15;
310 Led.Width := Led.Height;
311 Led.Bottom := ResultsLabel.Bottom + 1;
312 Led.Right := ResultsOutline.Right - 1;
313
314 SearchTextLabel1.XAlign := xaLeft;
315 SearchTextLabel1.YAlign := yaTop;
316
317 Bevel.XStretch := xsFrame;
318 Bevel.YAlign := yaTop;
319
320 LED.XAlign := xaRight;
321 LED.YAlign := yaTop;
322
323 SearchButton.Align := alFixedRightTop;
324
325 if SearchLocationComboBox.Items.Count = 0 then
326 begin
327 // must match teh global search location enum...
328 SearchLocationComboBox.Items.Add( StandardHelpPathsLocation );
329 SearchLocationComboBox.Items.Add( FixedDrivesLocation );
330 SearchLocationComboBox.Items.Add( SelectedHelpPathsLocation );
331 SearchLocationComboBox.Items.Add( CustomPathsLocation );
332
333 SearchLocationComboBox.ItemIndex := Ord( Settings.GlobalSearchLocation );
334 end;
335
336End;
337
338Procedure TGlobalSearchForm.OnLanguageEvent(Language: TLanguageFile; const Apply: boolean );
339begin
340 LogEvent(LogI18n, 'TGlobalSearchForm.OnLanguageEvent apply: "' + BoolToStr(Apply) + '"');
341
342 Language.LoadComponentLanguage(self, Apply);
343
344 Language.LL(Apply, SearchCaption, 'SearchCaption', '~Search');
345 Language.LL(Apply, StopCaption, 'StopCaption', '~Stop');
346 Language.LL(Apply, NoResultsMsg, 'NoResultsMsg', '(No results found)');
347 Language.LL(Apply, ScanDirectoriesMsg, 'ScanDirectoriesMsg', 'Finding help files...');
348 Language.LL(Apply, SearchingFileMsg, 'SearchingFileMsg', 'Searching ');
349 Language.LL(Apply, OfMsg, 'OfMsg', ' of ');
350 Language.LL(Apply, DoneMsg, 'DoneMsg', 'Done');
351 Language.LL(Apply, SearchErrorTitle, 'SearchErrorTitle', 'Search');
352 Language.LL(Apply, SearchError, 'SearchError', 'Error in search syntax: ');
353
354 Language.LL(Apply, StandardHelpPathsLocation, 'StandardHelpPathsLocation', 'Standard Help Paths');
355 Language.LL(Apply, FixedDrivesLocation, 'FixedDrivesLocation', 'All Hard Drives');
356 Language.LL(Apply, SelectedHelpPathsLocation, 'SelectedHelpPathsLocation', 'Selected Help Paths');
357 Language.LL(Apply, CustomPathsLocation, 'CustomPathsLocation', 'Directory List');
358end;
359
360
361Procedure TGlobalSearchForm.CancelButtonOnClick (Sender: TObject);
362Begin
363 Close;
364End;
365
366Procedure TGlobalSearchForm.GlobalSearchFormOnClose (Sender: TObject;
367 Var Action: TCloseAction);
368Begin
369 ClearResults;
370
371 if SearchLocationComboBox.ItemIndex = -1 then
372 begin
373 Settings.GlobalSearchLocation := gsCustom;
374 Settings.SearchDirectories.Clear;
375 Settings.SearchDirectories.Add( SearchLocationComboBox.Text );
376 end;
377
378 Action := caFreeHandle; // DON'T release the form! (Default action for non-modal forms)
379End;
380
381Procedure TGlobalSearchForm.ResultsOutlineOnItemDblClick (Node: TNode);
382Begin
383 ViewTopic;
384End;
385
386Procedure TGlobalSearchForm.ViewTopicButtonOnClick (Sender: TObject);
387begin
388 ViewTopic;
389end;
390
391Procedure TGlobalSearchForm.ViewTopic;
392var
393 Node: TNode;
394 HelpFileInfo: THelpFileInfo;
395 TopicIndex: longint;
396Begin
397 Node := ResultsOutline.SelectedNode;
398 if Node = nil then
399 exit;
400 case Node.Level of
401 0:
402 begin
403 // file node
404 HelpFileInfo := Node.Data as THelpFileInfo;
405 TopicIndex := -1;
406 end;
407
408 1:
409 begin
410 // topic node
411 HelpFileInfo := Node.Parent.Data as THelpFileInfo;
412 TopicIndex := longint( Node.Data );
413 end;
414
415 else
416 assert( false, 'Invalid node level in ViewTopic!: ' + IntToStr( Node.Level ) );
417 end;
418
419 ViewTopicCallback( HelpFileInfo.FileName, TopicIndex );
420End;
421
422Procedure TGlobalSearchForm.GlobalSearchFormOnCreate (Sender: TObject);
423Begin
424 RegisterForLanguages( OnLanguageEvent );
425
426 UpdateButtons;
427
428 ThreadManager := TGenericThreadManager.Create( self );
429 ThreadManager.OnProgressUpdate := OnSearchProgress;
430 ThreadManager.OnDataFromThread := OnThreadData;
431 ThreadManager.OnJobComplete := OnSearchFinished;
432End;
433
434Procedure TGlobalSearchForm.OnSearchFinished( Result: TObject );
435Begin
436 SearchButton.Caption := SearchCaption;
437 ProgressBar.Hide;
438 LED.LedCondition := false;
439 LEDTimer.Stop;
440
441 if ResultsOutline.ChildCount > 0 then
442 begin
443 ResultsOutline.SelectedNode:= ResultsOutline.Children[ 0 ];
444 ResultsOutline.Focus;
445 SetProgressLabel( '' );
446 end
447 else
448 begin
449 SetProgressLabel( NoResultsMsg );
450 end;
451
452End;
453
454Procedure TGlobalSearchForm.GlobalSearchFormOnCloseQuery (Sender: TObject;
455 Var CanClose: Boolean);
456Begin
457 if ThreadManager.IsRunning then
458 begin
459 ThreadManager.Stop;
460 end;
461End;
462
463Procedure TGlobalSearchForm.SetProgressLabel( const S: String );
464begin
465 ProgressLabel.Text := S;
466 ProgressLabel.Refresh;
467end;
468
469Procedure TGlobalSearchForm.OnSearchProgress ( n, outof: integer;
470 S: String );
471Begin
472 ProgressBar.Position := n * 100 div outof;
473 SetProgressLabel( S );
474End;
475
476Function TGlobalSearchForm.Search( Parameters: TObject ): TObject;
477var
478 Files : TStringList;
479 FileIndex: longint;
480 Filename: string;
481 HelpFile: THelpFile;
482 SearchResult: TSearchResult;
483 MatchingTopics: TList;
484
485 tmpSearchParameters : TSearchParameters;
486 Query: TTextSearchQuery;
487 i: longint;
488 tmpDir: string;
489
490Begin
491 // LogEvent(LogDebug, 'TGlobalSearchForm.Search');
492
493 tmpSearchParameters := Parameters as TSearchParameters;
494
495 Query := tmpSearchParameters.Query;
496 Files := TStringList.Create;
497
498 MatchingTopics := TList.Create;
499 LogEvent(LogParse, 'Creating file list');
500
501 // make sure we ignore duplicate files...
502 Files.Sorted := true;
503 Files.CaseSensitive := false;
504 Files.Duplicates := dupIgnore;
505
506 for i := 0 to tmpSearchParameters.Directories.Count - 1 do
507 begin
508 if ThreadManager.StopRequested then
509 begin
510 break;
511 end;
512
513 ThreadManager.UpdateProgress( i * 10 div tmpSearchParameters.Directories.Count, 100, ScanDirectoriesMsg );
514 tmpDir := tmpSearchParameters.Directories[i];
515 // LogEvent(LogDebug, 'TGlobalSearchForm.Search in dir: ' + tmpDir);
516 if StrEndsWith(tmpDir, '...') then
517 begin
518 tmpDir := StrLeftWithout(tmpDir, 3 );
519 ListFilesInDirectoryRecursiveWithTermination(
520 tmpDir,
521 '*.inf;*.hlp',
522 true,
523 false,
524 Files,
525 ThreadManager.StopRequested,
526 true ); // check termination
527 end
528 else
529 begin
530 ListFilesInDirectory( tmpDir, '*.inf;*.hlp', true, Files);
531 end;
532 end;
533
534 for FileIndex := 0 to Files.Count - 1 do
535 begin
536 if ThreadManager.StopRequested then
537 begin
538 break;
539 end;
540
541 Filename := Files[FileIndex];
542
543 ThreadManager.UpdateProgress( 10 + FileIndex * 95 div Files.Count,
544 100,
545 SearchingFileMsg
546 + Filename
547 + ' ('
548 + IntToStr( FileIndex + 1 )
549 + OfMsg
550 + IntToStr( Files.Count )
551 + ')...' );
552
553 try
554 HelpFile := THelpFile.Create( FileName );
555 MatchingTopics.Clear;
556 SearchHelpFile( HelpFile,
557 Query,
558 MatchingTopics,
559 nil // don't care about words matched
560 );
561
562 if MatchingTopics.Count > 0 then
563 begin
564 // Create a searchresult object to send back to main thread.
565 SearchResult := TSearchResult.Create;
566 SearchResult.Filename := HelpFile.Filename;
567 SearchResult.FileTitle := HelpFile.Title;
568
569 SearchResult.MatchingTopics.Assign( MatchingTopics );
570
571 SearchResult.MatchingTopics.Sort( TopicRelevanceCompare );
572 ThreadManager.SendData( '', SearchResult );
573 end;
574
575 HelpFile.Destroy;
576
577 except
578 on E: EHelpFileException do
579 begin
580 ; // ignore exceptions
581 end;
582
583 on E: EWindowsHelpFormatException do
584 begin
585 ; // ignore Windows help files
586 end;
587 end;
588
589 end;
590 ThreadManager.UpdateProgress( 100, 100, DoneMsg );
591 Files.Destroy;
592
593 Query.Destroy;
594
595 tmpSearchParameters.Directories.Destroy;
596 tmpSearchParameters.Destroy;
597
598 Result := nil;
599End;
600
601Procedure TGlobalSearchForm.ClearResults;
602var
603 FileIndex: longint;
604begin
605 for FileIndex := 0 to ResultsOutline.ChildCount - 1 do
606 ResultsOutline.Children[ FileIndex ].Data.Free;
607 ResultsOutline.Clear;
608 ViewTopicButton.Enabled := false;
609end;
610
611Procedure TGlobalSearchForm.SearchButtonOnClick (Sender: TObject);
612begin
613 DoSearch;
614end;
615
616Procedure TGlobalSearchForm.DoSearch;
617var
618 tmpSelectedDirectories : TStringList;
619 i : integer;
620 tmpSearchText: string;
621
622 Query: TTextSearchQuery;
623 SearchParameters: TSearchParameters;
624Begin
625 // LogEvent(LogDebug, 'DoSearch');
626
627 if ThreadManager.IsRunning then
628 begin
629 ThreadManager.Stop;
630 exit;
631 end;
632
633 tmpSearchText := trim( SearchTextEdit.Text );
634 if tmpSearchText = '' then
635 exit;
636
637 // LogEvent(LogDebug, 'DoSearch: ' + tmpSearchText);
638 try
639 Query := TTextSearchQuery.Create(tmpSearchText);
640 except
641 on e: ESearchSyntaxError do
642 begin
643 DoErrorDlg( SearchErrorTitle,
644 SearchError
645 + e.Message );
646 exit;
647 end;
648 end;
649
650 ClearResults;
651
652 SearchParameters := TSearchParameters.Create;
653
654 SearchParameters.Query := Query;
655
656 // now the directories to search in
657 SearchParameters.Directories := TStringList.Create;
658
659 tmpSelectedDirectories := TStringList.Create;
660 GetSelectedDirectories(tmpSelectedDirectories);
661
662 LogEvent(LogDebug, 'DoSearch: tmpSelectedDirectories.Count ' + IntToStr(tmpSelectedDirectories.Count));
663
664 // clear the list and add only the selected ones
665 for i := 0 to tmpSelectedDirectories.Count - 1 do
666 begin
667 if tmpSelectedDirectories.Objects[i] = nil then
668 begin
669 SearchParameters.Directories.add(tmpSelectedDirectories[i]);
670 end;
671 end;
672 tmpSelectedDirectories.Destroy;
673
674 ThreadManager.StartJob( Search, SearchParameters );
675 SearchButton.Caption := StopCaption;
676 ProgressBar.Show;
677
678 LED.LedCondition := true;
679 LEDTimer.Start;
680End;
681
682Procedure TGlobalSearchForm.GlobalSearchFormOnShow (Sender: TObject);
683Begin
684 // make search button default
685 SearchButton.Focus;
686 SearchTextEdit.Focus;
687 SetProgressLabel( '' );
688 PostMsg( Handle, WM_OPENED, 0, 0 );
689 SearchButton.Caption := SearchCaption;
690 ProgressBar.Hide;
691 ViewTopicButton.Enabled := false;
692End;
693
694Procedure TGlobalSearchForm.OnThreadData( S: string; Data: TObject );
695var
696 SearchResult: TSearchResult;
697begin
698 SearchResult := Data as TSearchResult;
699 OnMatchFound( SearchResult );
700 SearchResult.Destroy;
701end;
702
703Procedure TGlobalSearchForm.OnMatchFound( SearchResult: TSearchResult );
704var
705 Topic: TTopic;
706 HelpFileInfo: THelpFileInfo;
707 FileNode: TNode;
708 TopicIndex: longint;
709begin
710 ViewTopicButton.Enabled := true;
711
712 HelpFileInfo := THelpFileInfo.Create;
713 HelpFileInfo.FileName := SearchResult.FileName;
714 FileNode := ResultsOutline.AddChild( SearchResult.FileTitle
715 + ' ('
716 + SearchResult.FileName
717 + ')',
718 HelpFileInfo );
719 for TopicIndex := 0 to SearchResult.MatchingTopics.Count - 1 do
720 begin
721 Topic := SearchResult.MatchingTopics[ TopicIndex ];
722 FileNode.AddChild( Topic.Title,
723 TObject( Topic.Index ) );
724 end;
725end;
726
727Procedure TGlobalSearchForm.WMOpened( Var Msg: TMessage );
728begin
729 SearchTextLabel.XAlign := xaLeft;
730 SearchTextLabel.YAlign := yaTop;
731
732 SearchTextEdit.XStretch := xsFrame;
733 SearchTextEdit.YAlign := yaTop;
734 SearchTextEdit.Focus;
735
736 SearchButton.XAlign := xaRight;
737 SearchButton.YAlign := yaTop;
738
739 SearchLocationComboBox.XStretch := xsFrame;
740 SearchLocationComboBox.YAlign := yaTop;
741
742 SelectDrivesButton.XAlign := xaRight;
743 SelectDrivesButton.YAlign := yaTop;
744
745 ResultsLabel.XAlign := xaLeft;
746 ResultsLabel.YAlign := yaTop;
747
748 ProgressLabel.XStretch := xsFrame;
749 ProgressLabel.YAlign := yaTop;
750
751 ResultsOutline.XStretch := xsFrame;
752 ResultsOutline.YStretch := ysFrame;
753
754 ProgressBar.XStretch := xsFrame;
755 ProgressBar.YAlign := yaBottom;
756
757end;
758
759procedure EnsureGlobalSearchFormLoaded;
760begin
761 if GlobalSearchForm = nil then
762 GlobalSearchForm := TGlobalSearchForm.Create( nil );
763end;
764
765Initialization
766 RegisterClasses ([TGlobalSearchForm, TEdit, TLabel,
767 TProgressBar, TButton, TOutline2, TComboBox, TBevel, TLed, TTimer]);
768 RegisterUpdateProcForLanguages( EnsureGlobalSearchFormLoaded );
769End.
Note: See TracBrowser for help on using the repository browser.