@@ -298,8 +298,9 @@ procedure DebugLn(const Flags: EDebugLnFlags; bgColor: TColor; const Msg: String
298298
299299function GetLineColor (const color: EDebugLnColor): TColor;
300300
301+ function FlagsToByte (const flags: EDebugLnFlags): Byte;
301302function FlagsToString (const flags: EDebugLnFlags; const bgColor: TColor): String;
302- function FlagsFromString (var Str: String; out bgColor: Int32 ): EDebugLnFlags;
303+ function FlagsFromString (var Str: String; out bgColor: TColor ): EDebugLnFlags;
303304
304305function InRange (const AValue, AMin, AMax: Integer): Boolean; inline; overload;
305306function InRange (const AValue, AMin, AMax: Int64): Boolean; inline; overload;
@@ -448,30 +449,34 @@ procedure SimbaException(Message: String);
448449
449450function GetLineColor (const color: EDebugLnColor): TColor; inline;
450451const
451- DEBUG_LINE_COLORS: array [EDebugLnColor] of TColor = [
452- $00BFFF, $0000A5, $228B22
453- ];
452+ DEBUG_LINE_COLORS: TColorArray = ($00BFFF, $0000A5, $228B22);
454453begin
455- Result := DEBUG_LINE_COLORS[color];
454+ Result := DEBUG_LINE_COLORS[Ord( color) ];
456455end ;
457456
458457const
459458 DebugLnFlagsHeader = String(#0 #0 );
460459 DebugLnFlagsHeaderLength = Length(DebugLnFlagsHeader) + 6 ;
461460
461+ function FlagsToByte (const flags: EDebugLnFlags): Byte; inline;
462+ begin
463+ Result := 0 ;
464+ if EDebugLn.CLEAR in flags then Result := Result or 1 ;
465+ if EDebugLn.FOCUS in flags then Result := Result or 2 ;
466+ if EDebugLn.BACKGROUND_COLOR in flags then Result := Result or 4 ;
467+ end ;
468+
462469function FlagsToString (const flags: EDebugLnFlags; const bgColor: TColor): String; inline;
463470begin
464471 Result := DebugLnFlagsHeader;
465- Result := Result + Chr(Byte (flags));
472+ Result := Result + Chr(FlagsToByte (flags));
466473 if (EDebugLn.BACKGROUND_COLOR in flags) then
467- begin
468474 Result := Result + Chr((bgColor shr 16 ) and $FF) +
469475 Chr((bgColor shr 8 ) and $FF) +
470476 Chr(bgColor and $FF);
471- end ;
472477end ;
473478
474- function FlagsFromString (var str: String; out bgColor: Int32 ): EDebugLnFlags;
479+ function FlagsFromString (var str: String; out bgColor: TColor ): EDebugLnFlags;
475480var
476481 flagsByte: Byte;
477482 idx: Integer;
0 commit comments