Changeset 214
- Timestamp:
- Jun 13, 2007, 8:33:51 PM (18 years ago)
- Location:
- trunk/Components
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/CustomFontDialog.PAS
r15 r214 4 4 5 5 Uses 6 Classes, Forms, Dialogs, StdCtrls, Buttons, Graphics; 6 Classes, 7 Forms, 8 Dialogs, 9 StdCtrls, 10 Buttons, 11 Graphics; 7 12 8 13 Type … … 82 87 83 88 uses 84 SysUtils, PmWin, 85 ACLStringUtility; 89 SysUtils, 90 PmWin, 91 StringUtilsUnit; 86 92 87 93 // Returns true if s ends with endstr (case insensitive) … … 128 134 begin 129 135 Result := Font.Family; 130 Result := SubstituteChar( Result, '-', ' ' );131 Result := SubstituteChar( Result, '_', ' ' );136 SubstituteAllOccurencesOfChar( Result, '-', ' ' ); 137 SubstituteAllOccurencesOfChar( Result, '_', ' ' ); 132 138 133 139 if Result = 'Roman' then 134 if StrStarts ( 'Tms Rmn', Font.FaceName ) then140 if StrStartsWithIgnoringCase( 'Tms Rmn', Font.FaceName ) then 135 141 // one particularly stupid example 136 142 Result := 'Tms Rmn'; 137 143 138 144 if Result = 'Swiss' then 139 if StrStarts ( 'Helv', Font.FaceName ) then145 if StrStartsWithIgnoringCase( 'Helv', Font.FaceName ) then 140 146 // one particularly stupid example 141 147 Result := 'Helv'; … … 151 157 begin 152 158 Result := Font.FaceName; 153 Result := SubstituteChar( Result, '-', ' ' );154 Result := SubstituteChar( Result, '_', ' ' );159 SubstituteAllOccurencesOfChar( Result, '-', ' ' ); 160 SubstituteAllOccurencesOfChar( Result, '_', ' ' ); 155 161 156 162 FamilyName := GetFontFamilyName( Font ); 157 if StrStarts ( FamilyName, Result ) then163 if StrStartsWithIgnoringCase( FamilyName, Result ) then 158 164 begin 159 Result := Str RightFrom( Result, length( FamilyName ) + 1 );160 Result := TrimChars( Result, [ ' ', '-', '_' ] );165 Result := StrSubstringFrom( Result, length( FamilyName ) + 1 ); 166 Result := StrTrimChars( Result, [ ' ', '-', '_' ] ); 161 167 162 168 if Result = '' then -
trunk/Components/MultiColumnListBox.pas
r15 r214 175 175 176 176 uses 177 ACLStringUtility;177 StringUtilsUnit; 178 178 179 179 { TMultiColumnListBox } … … 292 292 Dest: TRect; 293 293 LineClipRect: TRect; 294 tmpColumns : TStringList; 295 i : longint; 294 296 begin 295 297 LineClipRect := FListBox.Canvas.ClipRect; … … 317 319 end; 318 320 319 while Line <> '' do 321 tmpColumns := TStringList.Create; 322 StrExtractStrings(tmpColumns, Line, [#9], #0); 323 324 for i := 0 to tmpColumns.Count - 1 do 320 325 begin 321 ItemToDraw := ExtractNextValue( Line, 322 #9 ); 326 ItemToDraw := tmpColumns[i]; 323 327 if ColumnIndex < FHeader.Sections.Count then 324 328 ColumnWidth := FHeader.Sections[ ColumnIndex ].Width … … 349 353 end 350 354 else 355 begin 356 tmpColumns.Destroy; 351 357 raise Exception.Create( 'Bitmap index out of range in MultiColumnListBox' ) 358 end 352 359 else 360 begin 361 tmpColumns.Destroy; 353 362 raise Exception.Create( 'No imagelist assigned in MultiColumnListBox' ); 354 363 end 355 364 end 356 365 else … … 362 371 inc( ColumnIndex ); 363 372 end; 373 tmpColumns.Destroy; 364 374 end; 365 375 -
trunk/Components/RichTextDocumentUnit.pas
r15 r214 118 118 uses 119 119 BseDOS, // for NLS/case mapping 120 SysUtils, ACLStringUtility; 120 SysUtils, 121 CharUtilsUnit, 122 StringUtilsUnit; 121 123 122 124 const … … 238 240 end; 239 241 240 if CurrentChar = DoubleQuote then242 if CurrentChar = CharDoubleQuote then 241 243 begin 242 244 if not InQuote then … … 247 249 begin 248 250 // Could be escaped quote "" 249 if ( TextPointer + 1 ) ^ = DoubleQuote then251 if ( TextPointer + 1 ) ^ = CharDoubleQuote then 250 252 begin 251 253 // yes it is … … 306 308 end; 307 309 308 if CurrentChar = DoubleQuote then310 if CurrentChar = CharDoubleQuote then 309 311 begin 310 312 if not InQuote then … … 320 322 InQuote := false; 321 323 end 322 else if ( TextPointer - 1 ) ^ = DoubleQuote then324 else if ( TextPointer - 1 ) ^ = CharDoubleQuote then 323 325 begin 324 326 // yes it is … … 502 504 begin 503 505 try 504 Color := Hex ToInt( StrRightFrom( ColorParam, 2 ) );506 Color := HexStrToLongInt( StrSubstringFrom( ColorParam, 2 ) ); 505 507 Result := true; 506 508 except … … 511 513 for ColorIndex := 0 to High( StandardColors ) do 512 514 begin 513 if Str ingsSame( ColorParam, StandardColors[ ColorIndex ].Name ) then515 if StrEqualIgnoringCase( ColorParam, StandardColors[ ColorIndex ].Name ) then 514 516 begin 515 517 Color := StandardColors[ ColorIndex ].Color; … … 525 527 const Default: TTextAlignment ): TTextAlignment; 526 528 begin 527 if Str ingsSame( AlignParam, 'left' ) then529 if StrEqualIgnoringCase( AlignParam, 'left' ) then 528 530 Result := taLeft 529 else if Str ingsSame( AlignParam, 'center' ) then531 else if StrEqualIgnoringCase( AlignParam, 'center' ) then 530 532 Result := taCenter 531 else if Str ingsSame( AlignParam, 'right' ) then533 else if StrEqualIgnoringCase( AlignParam, 'right' ) then 532 534 Result := taRight 533 535 else … … 537 539 function GetTagTextWrap( const WrapParam: string ): boolean; 538 540 begin 539 Result := Str ingsSame( WrapParam, 'yes' );541 Result := StrEqualIgnoringCase( WrapParam, 'yes' ); 540 542 end; 541 543 … … 619 621 Result := true; 620 622 pMatch := pMatchStart; 621 MatchLength := PChar Diff( P, pMatchStart )623 MatchLength := PCharPointerDiff( P, pMatchStart ) 622 624 + 1; // include this char 623 625 exit; … … 746 748 end; 747 749 pWordStart := P; 748 WordLength := PChar Diff( pWordEnd, pWordStart );750 WordLength := PCharPointerDiff( pWordEnd, pWordStart ); 749 751 Result := true; 750 752 end; … … 798 800 P := NextP; 799 801 end; 800 result := PChar Diff( Q, Buffer );802 result := PCharPointerDiff( Q, Buffer ); 801 803 end; 802 804 -
trunk/Components/RichTextLayoutUnit.pas
r15 r214 145 145 146 146 Uses 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; 150 157 151 158 Function TRichTextLayout.GetTextEnd: longint; … … 313 320 inc( FHeight, CurrentLine.Height ); 314 321 315 CurrentLine.Length := PChar Diff( EndPoint, CurrentLine.Text );322 CurrentLine.Length := PCharPointerDiff( EndPoint, CurrentLine.Text ); 316 323 317 324 CurrentLine.Width := EndX; … … 771 778 begin 772 779 // found 773 Offset := PChar Diff( P, Line.Text );780 Offset := PCharPointerDiff( P, Line.Text ); 774 781 Link := CurrentLink; 775 782 exit; … … 1027 1034 Function TRichTextLayout.GetCharIndex( P: PChar ): longint; 1028 1035 begin 1029 Result := PChar Diff( P, FText );1036 Result := PCharPointerDiff( P, FText ); 1030 1037 end; 1031 1038 -
trunk/Components/RichTextStyleUnit.pas
r39 r214 4 4 5 5 uses 6 Forms, Classes, Graphics, CanvasFontManager, RichTextDocumentUnit; 6 Forms, 7 Classes, 8 Graphics, 9 CanvasFontManager, 10 RichTextDocumentUnit; 7 11 8 12 type … … 144 148 uses 145 149 SysUtils, 146 ACLStringUtility; 147 // ACLProfile; 150 StringUtilsUnit; 148 151 149 152 Procedure ApplyStyle( const Style: TTextDrawStyle; … … 169 172 XSizeStr: string; 170 173 YSizeStr: string; 174 tmpFontParts : TStringList; 171 175 172 176 MarginSize: longint; … … 203 207 ttFont: 204 208 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 208 215 NewStyle := Style; 209 216 try … … 212 219 if Pos( 'x', FontSizeString ) > 0 then 213 220 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 216 227 NewStyle.Font.XSize := StrToInt( XSizeStr ); 217 228 NewStyle.Font.YSize := StrToInt( YSizeStr ); … … 265 276 ttSetRightMargin: 266 277 begin 278 tmpFontParts := TStringList.Create; 279 StrExtractStrings(tmpFontParts, Tag.Arguments, [' '], #0); 280 MarginParam1 := tmpFontParts[0]; 281 tmpFontParts.Destroy; 282 267 283 ParsePoint := 1; 268 GetNextValue( Tag.Arguments, ParsePoint, MarginParam1, ' ' );269 284 if ( Tag.TagType = ttSetLeftMargin ) 270 285 and ( MarginParam1 = 'here' ) then … … 276 291 try 277 292 MarginSize := StrToInt( MarginParam1 ); 278 GetNextValue( Tag.Arguments, ParsePoint, MarginParam2, ' ' );293 MarginParam2 := tmpFontParts[1]; 279 294 if MarginParam2 = 'pixels' then 280 295 NewMargin := MarginSize
Note:
See TracChangeset
for help on using the changeset viewer.