Changeset 252 for trunk/NewView


Ignore:
Timestamp:
Sep 21, 2007, 5:57:18 PM (18 years ago)
Author:
RBRi
Message:

fix for #33
fix usage of StrStartsWithIgnoringCase

Location:
trunk/NewView
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/HelpFile.pas

    r228 r252  
    669669var
    670670  i: longint;
     671  tmpIndex: String;
    671672begin
    672673  result := nil;
     
    674675  for i := 0 to _Index.Count - 1 do
    675676  begin
    676     if StrStartsWithIgnoringCase( SearchText, _Index.ValuePtrs[ i ] ^ ) then
     677    tmpIndex := _Index.ValuePtrs[i]^;
     678    if StrStartsWithIgnoringCase(tmpIndex, SearchText) then
    677679    begin
    678680      // found
     
    718720      if tmpLevel = tmpTopic.ContentsLevel then
    719721      begin
    720         if StrStartsWithIgnoringCase( SearchText, tmpTopic.TitlePtr ^ ) then
     722        if StrStartsWithIgnoringCase(tmpTopic.TitlePtr^, SearchText) then
    721723        begin
    722724          result := tmpTopic;
  • trunk/NewView/HelpTopic.pas

    r228 r252  
    10521052      ProgramFilename := ExtractFilename( ProgramPath );
    10531053
    1054       if    StrStartsWithIgnoringCase(PRGM_EXPLORER, ProgramFilename ) // web explorer?
    1055          or StrStartsWithIgnoringCase(PRGM_NETSCAPE, ProgramFilename )
    1056          or StrStartsWithIgnoringCase(PRGM_MOZILLA, ProgramFilename )
    1057          or StrStartsWithIgnoringCase(PRGM_FIREFOX, ProgramFilename )
     1054      if    StrStartsWithIgnoringCase(ProgramFilename, PRGM_EXPLORER)
     1055         or StrStartsWithIgnoringCase(ProgramFilename, PRGM_NETSCAPE)
     1056         or StrStartsWithIgnoringCase(ProgramFilename, PRGM_MOZILLA)
     1057         or StrStartsWithIgnoringCase(ProgramFilename, PRGM_FIREFOX)
    10581058         then
    10591059      begin
  • trunk/NewView/MainForm.pas

    r236 r252  
    23842384  Filename := THelpFile( CurrentOpenFiles[ 0 ] ).Filename;
    23852385  NamePart := ExtractFileName( Filename );
    2386   Result := StrStartsWithIgnoringCase('newview', NamePart);
     2386  Result := StrStartsWithIgnoringCase(NamePart, 'newview');
    23872387end;
    23882388
     
    44874487End;
    44884488
    4489 Procedure TMainForm.IndexSearchEditOnScan (Sender: TObject;
    4490   Var KeyCode: TKeyCode);
     4489Procedure TMainForm.IndexSearchEditOnScan (Sender: TObject; Var KeyCode: TKeyCode);
    44914490Begin
    44924491  case KeyCode of
     
    45154514Procedure TMainForm.IndexSearchEditOnChange (Sender: TObject);
    45164515var
    4517   MatchIndex: longint;
    4518   IndexINdex: longint;
    4519   SearchText: string;
     4516  tmpMatchIndex : longint;
     4517  tmpSearchText: string;
     4518  i : longint;
    45204519Begin
    45214520  if InIndexSearch then
    45224521    exit;
    45234522
    4524   MatchIndex:= -1;
    4525   SearchText:= trim( IndexSearchEdit.Text );
    4526   for IndexIndex:= 0 to DisplayedIndex.Count - 1 do
    4527   begin
    4528     if StrStartsWithIgnoringCase( SearchText, DisplayedIndex[ IndexIndex ] ) then //IndexEntry ) then
     4523  tmpMatchIndex := -1;
     4524  tmpSearchText := trim(IndexSearchEdit.Text);
     4525
     4526  for i := 0 to DisplayedIndex.Count - 1 do
     4527  begin
     4528    if StrStartsWithIgnoringCase(DisplayedIndex[i], tmpSearchText) then
    45294529    begin
    4530       MatchIndex:= IndexIndex;
     4530      tmpMatchIndex := i;
    45314531      break;
    45324532    end;
    45334533  end;
    45344534
    4535   if MatchIndex = -1 then
     4535  if tmpMatchIndex = -1 then
    45364536    exit;
    45374537
    45384538  InIndexSearch:= true;
    45394539
    4540   if IndexListBox.ItemIndex <> MatchIndex then
    4541     IndexListBox.ItemIndex:= MatchIndex;
     4540  if IndexListBox.ItemIndex <> tmpMatchIndex then
     4541    IndexListBox.ItemIndex:= tmpMatchIndex;
    45424542
    45434543  InIndexSearch:= false;
  • trunk/NewView/SearchUnit.pas

    r115 r252  
    168168  begin
    169169    DictWord := HelpFile.DictionaryWords[ DictIndex ];
    170     if StrStartsWithIgnoringCase( SearchWord, DictWord ) then
     170    if StrStartsWithIgnoringCase(DictWord, SearchWord) then
    171171      Results[ DictIndex ] := MatchedWordRelevance( SearchWord, DictWord );
    172172  end;
Note: See TracChangeset for help on using the changeset viewer.