Ignore:
Timestamp:
Apr 30, 2007, 9:01:02 PM (18 years ago)
Author:
RBRi
Message:

more refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/HelpTopic.pas

    r127 r140  
    253253  NewViewConstantsUnit,
    254254  ACLUtility,
    255   ACLStringUtility,
    256255  ACLFileIOUtility,
    257256  AStringUtilityUnit,
    258257  ACLLanguageUnit,
    259258  StringUtilsUnit,
     259  CharUtilsUnit,
    260260  SettingsUnit;
    261261
     
    565565
    566566  Write( F, ':artwork name=' );
    567   Write( F, StrQuote( 'img' + IntToStr( ImageIndex ) + '.bmp' ) );
     567  Write( F, StrInSingleQuotes('img' + IntToStr(ImageIndex) + '.bmp') );
    568568
    569569  case BitmapFlags and 7 of
     
    826826end;
    827827
     828// TODO
    828829function FullDoubleQuote( const s: string ): string;
    829830begin
    830   Result := DoubleQuote
    831             + InsertDuplicateChars( s,
    832                                     DoubleQuote )
    833             + DoubleQuote;
     831  Result := StrDoubleQuote
     832            + StrEscapeAllCharsBy(s, [], CharDoubleQuote)
     833            + StrDoubleQuote;
    834834end;
    835835
     
    906906  ProgramFilename: string;
    907907  ProgramInfo : TSerializableStringList;
     908  tmpProgramLinkParts : TStringList;
    908909
    909910  OutputString: string;
     
    10311032      // :link reftype=hd refid=... database=<filename>
    10321033      ExternalLinkFileIndex := ( pData + 2 )^;
    1033       ExternalLinkTopicID := StrNPas( pchar( pData + 4 ), ( pData + 3 )^ );
     1034      ExternalLinkTopicID := StrPasWithLength( pchar( pData + 4 ), ( pData + 3 )^ );
    10341035      OutputString := '<blue><link ' + PARAM_LINK_EXTERNAL + ' '
    10351036                      + IntToStr( ExternalLinkFileIndex )
     
    10431044    begin
    10441045      CheckForAutoURL( Text, State );
    1045       ProgramLink := StrNPas( pchar( pData + 3 ), EscapeLen - 3 );
    1046       ProgramPath := ExtractNextValue( ProgramLink, ' ' );
     1046      ProgramLink := StrPasWithLength( pchar( pData + 3 ), EscapeLen - 3 );
     1047
     1048      tmpProgramLinkParts := TStringList.Create;
     1049      StrExtractStrings(tmpProgramLinkParts, ProgramLink, [' '], #0);
     1050      ProgramPath := tmpProgramLinkParts[0];
     1051      tmpProgramLinkParts.Destroy;
     1052
    10471053      ProgramFilename := ExtractFilename( ProgramPath );
    1048       if    StrStarts( 'netscape', ProgramFilename )
    1049          or StrStarts( 'explore', ProgramFilename ) // web explorer?
    1050          or StrStarts( 'mozilla', ProgramFilename )
     1054
     1055      if    StrStartsWithIgnoringCase(PRGM_EXPLORER, ProgramFilename ) // web explorer?
     1056         or StrStartsWithIgnoringCase(PRGM_NETSCAPE, ProgramFilename )
     1057         or StrStartsWithIgnoringCase(PRGM_MOZILLA, ProgramFilename )
     1058         or StrStartsWithIgnoringCase(PRGM_FIREFOX, ProgramFilename )
    10511059         then
    10521060      begin
     
    12011209        begin
    12021210          pFontSpec := _FontTable[ FontIndex ];
    1203           FaceName := StrNPas( pFontSpec ^. FaceName,
     1211          FaceName := StrPasWithLength( pFontSpec ^. FaceName,
    12041212                               sizeof( pFontSpec ^. FaceName ) );
    12051213          // arbitrarily and capriciously use specified height * 2/3
     
    15111519
    15121520        // s := pstring( _GlobalDictionary[ DictIndex ] )^; // for debug only
    1513         if not IsSpaces( pstring( _GlobalDictionary[ DictIndex ] )^ ) then
     1521        if not StrIsEmptyOrSpaces( pstring( _GlobalDictionary[ DictIndex ] )^ ) then
    15141522        begin
    15151523          if pSequenceStepWords^[ DictIndex ] = 0 then
     
    16381646          StringToAdd := '';
    16391647
    1640         if IsSpaces( StringToAdd ) then
     1648        if StrIsEmptyOrSpaces( StringToAdd ) then
    16411649        begin
    16421650          // spaces only...
     
    20222030
    20232031      if GlobalDictIndex < _GlobalDictionary.Count then
    2024         if not IsSpaces( pstring( _GlobalDictionary[ GlobalDictIndex ] )^ ) then;
     2032        if not StrIsEmptyOrSpaces( pstring( _GlobalDictionary[ GlobalDictIndex ] )^ ) then;
    20252033          WordRelevance := pStepWordRelevances[ GlobalDictIndex ];
    20262034
     
    22652273  ProgramLink: string;
    22662274  ProgramPath: string;
     2275  tmpProgramLinkParts : TStringList;
    22672276
    22682277  OutputString: string;
     
    23722381    begin
    23732382      ExternalLinkFileIndex := ( pData + 2 )^;
    2374       ExternalLinkTopicID := StrNPas( pchar( pData + 4 ), ( pData + 3 )^ );
     2383      ExternalLinkTopicID := StrPasWithLength( pchar( pData + 4 ), ( pData + 3 )^ );
    23752384      Write( F, ':link reftype=hd '
    2376              + ' refid=' + StrQuote( ExternalLinkTopicID )
    2377              + ' database=' + StrQuote( _ReferencedFiles[ ExternalLinkFileIndex ] )
     2385             + ' refid=' + StrInSingleQuotes( ExternalLinkTopicID )
     2386             + ' database=' + StrInSingleQuotes( _ReferencedFiles[ ExternalLinkFileIndex ] )
    23782387             + '.' );
    23792388
     
    23822391    ecProgramLink:
    23832392    begin
    2384       ProgramLink := StrNPas( pchar( pData + 3 ), EscapeLen - 3 );
    2385       ProgramPath := ExtractNextValue( ProgramLink, ' ' );
     2393      ProgramLink := StrPasWithLength( pchar( pData + 3 ), EscapeLen - 3 );
     2394
     2395      tmpProgramLinkParts := TStringList.Create;
     2396      StrExtractStrings(tmpProgramLinkParts, ProgramLink, [' '], #0);
     2397      ProgramPath := tmpProgramLinkParts[0];
     2398      tmpProgramLinkParts.Destroy;
     2399
    23862400      Write( F, ':link reftype=launch'
    2387              + ' object=' + StrQuote( ProgramPath )
    2388              + ' data=' + StrQuote( ProgramLink )
     2401             + ' object=' + StrInSingleQuotes( ProgramPath )
     2402             + ' data=' + StrInSingleQuotes( ProgramLink )
    23892403             + '.' );
    23902404    end;
     
    25062520        begin
    25072521          pFontSpec := _FontTable[ FontIndex ];
    2508           FaceName := StrNPas( pFontSpec ^. FaceName,
     2522          FaceName := StrPasWithLength( pFontSpec ^. FaceName,
    25092523                               sizeof( pFontSpec ^. FaceName ) );
    25102524          Write( F,
    2511                  ':font facename=' + StrQuote( FaceName )
     2525                 ':font facename=' + StrInSingleQuotes( FaceName )
    25122526                 + ' size=' + IntToStr( pFontSpec ^. Height )
    25132527                   + 'x' + IntToStr( pFontSpec ^. Width )
Note: See TracChangeset for help on using the changeset viewer.