diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-25 16:43:55 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-25 16:43:55 +0100 |
commit | 374bfb2a0b6bd8f5b3cf6f073ab74aba854d0212 (patch) | |
tree | fe4a07cfa9c08d9fb32d5f27c32eff9718e520b5 /docview/src | |
parent | 907f2193692b7167e6570ea90f9fbfee4260ca13 (diff) | |
download | fpGUI-374bfb2a0b6bd8f5b3cf6f073ab74aba854d0212.tar.xz |
docview: minor code formatting changes
Diffstat (limited to 'docview/src')
-rw-r--r-- | docview/src/CompareWordUnit.pas | 28 | ||||
-rw-r--r-- | docview/src/frm_main.pas | 8 |
2 files changed, 14 insertions, 22 deletions
diff --git a/docview/src/CompareWordUnit.pas b/docview/src/CompareWordUnit.pas index 49c2ea26..05f32cc8 100644 --- a/docview/src/CompareWordUnit.pas +++ b/docview/src/CompareWordUnit.pas @@ -2,11 +2,7 @@ Unit CompareWordUnit; {$mode objfpc}{$H+} -// NewView - a new OS/2 Help Viewer -// Copyright 2001 Aaron Lawrence (aaronl at consultant dot com) -// This software is released under the Gnu Public License - see readme.txt - -Interface +interface // Compares words and produces a match level (relevance) based // on the relative sizes etc. Used in searching help files @@ -21,15 +17,15 @@ const // Compares the given search word against the given // reference word. Returns a value indicating how well the // search word matches, 0 = not at all. -function CompareWord( const SearchWord: string; - const ReferenceWord: string ): longint; +function CompareWord( const SearchWord: string; const ReferenceWord: string ): longint; + -Implementation +implementation uses SysUtils; -// LOoks for string a within string b, case insensitively +// Looks for string a within string b, case insensitively function CaseInsensitivePos( const a, b: string ): longint; begin // Budget implementation to begin with. @@ -63,21 +59,16 @@ begin if OccurrencePos = 1 then begin // word starts with searchword - Result := mwWordStart - * Length( SearchWord ) - div Length( ReferenceWord ); + Result := mwWordStart * Length(SearchWord) div Length(ReferenceWord); if Result = 0 then Result := 1; exit; end; // Matched searchword somewhere within word - Result := mwWordWithin - * Length( SearchWord ) - div Length( ReferenceWord ); + Result := mwWordWithin * Length(SearchWord) div Length(ReferenceWord); if Result = 0 then Result := 1; - end; {// Note: searchstring must be uppercase, @@ -103,5 +94,6 @@ begin end; end; } -Initialization -End. + +end. + diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas index 4c13be14..8110a475 100644 --- a/docview/src/frm_main.pas +++ b/docview/src/frm_main.pas @@ -1333,7 +1333,7 @@ begin if SearchText = '' then begin ClearAllWordSequences; - exit; + exit; //==> end; lbSearchResults.Items.Add(rsDVSearchingMsg); @@ -1345,7 +1345,7 @@ begin on e: ESearchSyntaxError do begin TfpgMessageDialog.Critical( rsSearch, rsDVSearchSyntaxError + e.Message ); - exit; + exit; //==> end; end; @@ -1355,7 +1355,7 @@ begin SearchResults := TList.Create; - // Search open help file + // Search open help files for FileIndex := 0 to CurrentOpenFiles.Count - 1 do begin HelpFile := THelpFile(CurrentOpenFiles[ FileIndex ]); @@ -1371,7 +1371,7 @@ begin TfpgMessageDialog.Critical(rsError , E.Message); Query.Destroy; ClearWaitCursor; - exit; + exit; //==> end; end; |