Changeset 214


Ignore:
Timestamp:
Jun 13, 2007, 8:33:51 PM (18 years ago)
Author:
RBRi
Message:

using StringUtilsUnit

Location:
trunk/Components
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Components/CustomFontDialog.PAS

    r15 r214  
    44
    55Uses
    6   Classes, Forms, Dialogs, StdCtrls, Buttons, Graphics;
     6  Classes,
     7  Forms,
     8  Dialogs,
     9  StdCtrls,
     10  Buttons,
     11  Graphics;
    712
    813Type
     
    8287
    8388uses
    84   SysUtils, PmWin,
    85   ACLStringUtility;
     89  SysUtils,
     90  PmWin,
     91  StringUtilsUnit;
    8692
    8793// Returns true if s ends with endstr (case insensitive)
     
    128134begin
    129135  Result := Font.Family;
    130   Result := SubstituteChar( Result, '-', ' ' );
    131   Result := SubstituteChar( Result, '_', ' ' );
     136  SubstituteAllOccurencesOfChar( Result, '-', ' ' );
     137  SubstituteAllOccurencesOfChar( Result, '_', ' ' );
    132138
    133139  if Result = 'Roman' then
    134     if StrStarts( 'Tms Rmn', Font.FaceName ) then
     140    if StrStartsWithIgnoringCase( 'Tms Rmn', Font.FaceName ) then
    135141      // one particularly stupid example
    136142      Result := 'Tms Rmn';
    137143
    138144  if Result = 'Swiss' then
    139     if StrStarts( 'Helv', Font.FaceName ) then
     145    if StrStartsWithIgnoringCase( 'Helv', Font.FaceName ) then
    140146      // one particularly stupid example
    141147      Result := 'Helv';
     
    151157begin
    152158  Result := Font.FaceName;
    153   Result := SubstituteChar( Result, '-', ' ' );
    154   Result := SubstituteChar( Result, '_', ' ' );
     159  SubstituteAllOccurencesOfChar( Result, '-', ' ' );
     160  SubstituteAllOccurencesOfChar( Result, '_', ' ' );
    155161
    156162  FamilyName := GetFontFamilyName( Font );
    157   if StrStarts( FamilyName, Result ) then
     163  if StrStartsWithIgnoringCase( FamilyName, Result ) then
    158164  begin
    159     Result := StrRightFrom( Result, length( FamilyName ) + 1 );
    160     Result := TrimChars( Result, [ ' ', '-', '_' ] );
     165    Result := StrSubstringFrom( Result, length( FamilyName ) + 1 );
     166    Result := StrTrimChars( Result, [ ' ', '-', '_' ] );
    161167
    162168    if Result = '' then
  • trunk/Components/MultiColumnListBox.pas

    r15 r214  
    175175
    176176uses
    177   ACLStringUtility;
     177  StringUtilsUnit;
    178178 
    179179{ TMultiColumnListBox }
     
    292292  Dest: TRect;
    293293  LineClipRect: TRect;
     294  tmpColumns : TStringList;
     295  i : longint;
    294296begin
    295297  LineClipRect := FListBox.Canvas.ClipRect;
     
    317319  end;
    318320
    319   while Line <> '' do
     321  tmpColumns := TStringList.Create;
     322  StrExtractStrings(tmpColumns, Line, [#9], #0);
     323
     324  for i := 0 to tmpColumns.Count - 1 do
    320325  begin
    321     ItemToDraw := ExtractNextValue( Line,
    322                                    #9 );
     326    ItemToDraw := tmpColumns[i];
    323327    if ColumnIndex < FHeader.Sections.Count then
    324328      ColumnWidth := FHeader.Sections[ ColumnIndex ].Width
     
    349353        end
    350354        else
     355        begin
     356          tmpColumns.Destroy;
    351357          raise Exception.Create( 'Bitmap index out of range in MultiColumnListBox' )
     358        end
    352359      else
     360      begin
     361        tmpColumns.Destroy;
    353362        raise Exception.Create( 'No imagelist assigned in MultiColumnListBox' );
    354 
     363      end
    355364    end
    356365    else
     
    362371    inc( ColumnIndex );
    363372  end;
     373  tmpColumns.Destroy;
    364374end;
    365375
  • trunk/Components/RichTextDocumentUnit.pas

    r15 r214  
    118118uses
    119119  BseDOS, // for NLS/case mapping
    120   SysUtils, ACLStringUtility;
     120  SysUtils,
     121  CharUtilsUnit,
     122  StringUtilsUnit;
    121123
    122124const
     
    238240    end;
    239241
    240     if CurrentChar = DoubleQuote then
     242    if CurrentChar = CharDoubleQuote then
    241243    begin
    242244      if not InQuote then
     
    247249      begin
    248250        // Could be escaped quote ""
    249         if ( TextPointer + 1 ) ^ = DoubleQuote then
     251        if ( TextPointer + 1 ) ^ = CharDoubleQuote then
    250252        begin
    251253          // yes it is
     
    306308    end;
    307309
    308     if CurrentChar = DoubleQuote then
     310    if CurrentChar = CharDoubleQuote then
    309311    begin
    310312      if not InQuote then
     
    320322          InQuote := false;
    321323        end
    322         else if ( TextPointer - 1 ) ^ = DoubleQuote then
     324        else if ( TextPointer - 1 ) ^ = CharDoubleQuote then
    323325        begin
    324326          // yes it is
     
    502504    begin
    503505      try
    504         Color := HexToInt( StrRightFrom( ColorParam, 2 ) );
     506        Color := HexStrToLongInt( StrSubstringFrom( ColorParam, 2 ) );
    505507        Result := true;
    506508      except
     
    511513      for ColorIndex := 0 to High( StandardColors ) do
    512514      begin
    513         if StringsSame( ColorParam, StandardColors[ ColorIndex ].Name ) then
     515        if StrEqualIgnoringCase( ColorParam, StandardColors[ ColorIndex ].Name ) then
    514516        begin
    515517          Color := StandardColors[ ColorIndex ].Color;
     
    525527                              const Default: TTextAlignment ): TTextAlignment;
    526528begin
    527   if StringsSame( AlignParam, 'left' ) then
     529  if StrEqualIgnoringCase( AlignParam, 'left' ) then
    528530    Result := taLeft
    529   else if StringsSame( AlignParam, 'center' ) then
     531  else if StrEqualIgnoringCase( AlignParam, 'center' ) then
    530532    Result := taCenter
    531   else if StringsSame( AlignParam, 'right' ) then
     533  else if StrEqualIgnoringCase( AlignParam, 'right' ) then
    532534    Result := taRight
    533535  else
     
    537539function GetTagTextWrap( const WrapParam: string ): boolean;
    538540begin
    539   Result := StringsSame( WrapParam, 'yes' );
     541  Result := StrEqualIgnoringCase( WrapParam, 'yes' );
    540542end;
    541543
     
    619621            Result := true;
    620622            pMatch := pMatchStart;
    621             MatchLength := PCharDiff( P, pMatchStart )
     623            MatchLength := PCharPointerDiff( P, pMatchStart )
    622624                           + 1; // include this char
    623625            exit;
     
    746748  end;
    747749  pWordStart := P;
    748   WordLength := PCharDiff( pWordEnd, pWordStart );
     750  WordLength := PCharPointerDiff( pWordEnd, pWordStart );
    749751  Result := true;
    750752end;
     
    798800    P := NextP;
    799801  end;
    800   result := PCharDiff( Q, Buffer );
     802  result := PCharPointerDiff( Q, Buffer );
    801803end;
    802804
  • trunk/Components/RichTextLayoutUnit.pas

    r15 r214  
    145145
    146146Uses
    147   SysUtils, PMWin, BseDos, Dos, ClipBrd, Printers,
    148   ACLUtility, ACLStringUtility, ACLString,
    149   ControlScrolling;
     147  SysUtils,
     148  PMWin,
     149  BseDos,
     150  Dos,
     151  ClipBrd,
     152  Printers,
     153  ACLUtility,
     154  ACLString,
     155  ControlScrolling,
     156  CharUtilsUnit;
    150157
    151158Function TRichTextLayout.GetTextEnd: longint;
     
    313320    inc( FHeight, CurrentLine.Height );
    314321
    315     CurrentLine.Length := PCharDiff( EndPoint, CurrentLine.Text );
     322    CurrentLine.Length := PCharPointerDiff( EndPoint, CurrentLine.Text );
    316323
    317324    CurrentLine.Width := EndX;
     
    771778        begin
    772779          // found
    773           Offset := PCharDiff( P, Line.Text );
     780          Offset := PCharPointerDiff( P, Line.Text );
    774781          Link := CurrentLink;
    775782          exit;
     
    10271034Function TRichTextLayout.GetCharIndex( P: PChar ): longint;
    10281035begin
    1029   Result := PCharDiff( P, FText );
     1036  Result := PCharPointerDiff( P, FText );
    10301037end;
    10311038
  • trunk/Components/RichTextStyleUnit.pas

    r39 r214  
    44
    55uses
    6   Forms, Classes, Graphics, CanvasFontManager, RichTextDocumentUnit;
     6  Forms,
     7  Classes,
     8  Graphics,
     9  CanvasFontManager,
     10  RichTextDocumentUnit;
    711
    812type
     
    144148uses
    145149  SysUtils,
    146   ACLStringUtility;
    147 //  ACLProfile;
     150  StringUtilsUnit;
    148151
    149152Procedure ApplyStyle( const Style: TTextDrawStyle;
     
    169172  XSizeStr: string;
    170173  YSizeStr: string;
     174  tmpFontParts : TStringList;
    171175
    172176  MarginSize: longint;
     
    203207    ttFont:
    204208    begin
    205       ParseIndex := 1;
    206       GetNextQuotedValue( Tag.Arguments, ParseIndex, FontFaceName, DoubleQuote );
    207       GetNextQuotedValue( Tag.Arguments, ParseIndex, FontSizeString, DoubleQuote );
     209      tmpFontParts := TStringList.Create;
     210      StrExtractStringsQuoted(tmpFontParts, Tag.Arguments);
     211      FontFaceName := tmpFontParts[0];
     212      FontSizeString := tmpFontParts[1];
     213      tmpFontParts.Destroy;
     214
    208215      NewStyle := Style;
    209216      try
     
    212219        if Pos( 'x', FontSizeString ) > 0 then
    213220        begin
    214           XSizeStr := ExtractNextValue( FontSizeString, 'x' );
    215           YSizeStr := FontSizeString;
     221          tmpFontParts := TStringList.Create;
     222          StrExtractStrings(tmpFontParts, FontSizeString, ['x'], #0);
     223          XSizeStr := tmpFontParts[0];
     224          YSizeStr := tmpFontParts[1];
     225          tmpFontParts.Destroy;
     226
    216227          NewStyle.Font.XSize := StrToInt( XSizeStr );
    217228          NewStyle.Font.YSize := StrToInt( YSizeStr );
     
    265276    ttSetRightMargin:
    266277    begin
     278      tmpFontParts := TStringList.Create;
     279      StrExtractStrings(tmpFontParts, Tag.Arguments, [' '], #0);
     280      MarginParam1 := tmpFontParts[0];
     281      tmpFontParts.Destroy;
     282
    267283      ParsePoint := 1;
    268       GetNextValue( Tag.Arguments, ParsePoint, MarginParam1, ' ' );
    269284      if     ( Tag.TagType = ttSetLeftMargin )
    270285         and ( MarginParam1 = 'here' ) then
     
    276291        try
    277292          MarginSize := StrToInt( MarginParam1 );
    278           GetNextValue( Tag.Arguments, ParsePoint, MarginParam2, ' ' );
     293          MarginParam2 := tmpFontParts[1];
    279294          if MarginParam2 = 'pixels' then
    280295            NewMargin := MarginSize
Note: See TracChangeset for help on using the changeset viewer.