ColorPalette: Modify palette file reader to be case-insensitive.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4304 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-08-29 14:56:37 +00:00
parent 2192c0ab35
commit 168feae37d

View File

@ -512,6 +512,7 @@ procedure TCustomColorPalette.LoadPalette(const FileName: String;
var var
F: TextFile; F: TextFile;
Line: String; Line: String;
ucline: String;
C: TColor; C: TColor;
clrName: String; clrName: String;
p, steps: Integer; p, steps: Integer;
@ -598,54 +599,55 @@ begin
if p > 0 then if p > 0 then
Line := TrimRight(Copy(Line, 1, p-1)); Line := TrimRight(Copy(Line, 1, p-1));
// Parse data lines // Parse data lines
if Line[1] = '$' then ucLine := Uppercase(Line);
if ucLine[1] = '$' then
begin begin
if Copy(Line, 2, 4) = 'NONE' then if Copy(ucLine, 2, 4) = 'NONE' then
DoAddColor(clNone) DoAddColor(clNone)
else else
if (Copy(Line, 2, 4) = 'COLS') and (piColumnCount in AItems) then if (Copy(ucLine, 2, 4) = 'COLS') and (piColumnCount in AItems) then
FCols := StrToIntDef(Copy(Line, 6, MaxInt), FCols) FCols := StrToIntDef(Copy(Line, 6, MaxInt), FCols)
else else
if (Copy(Line, 2, 7) = 'BTNDIST') and (piButtonDistance in AItems) then if (Copy(ucLine, 2, 7) = 'BTNDIST') and (piButtonDistance in AItems) then
FButtonDistance := StrToIntDef(Copy(Line, 9, MaxInt), FButtonDistance) FButtonDistance := StrToIntDef(Copy(Line, 9, MaxInt), FButtonDistance)
else else
if (Copy(Line, 2, 8) = 'BTNWIDTH') and (piButtonSize in AItems) then if (Copy(ucLine, 2, 8) = 'BTNWIDTH') and (piButtonSize in AItems) then
FButtonWidth := StrToIntDef(Copy(Line, 10, MaxInt), FButtonWidth) FButtonWidth := StrToIntDef(Copy(Line, 10, MaxInt), FButtonWidth)
else else
if (Copy(Line, 2, 9) = 'BTNHEIGHT') and (piButtonSize in AItems) then if (Copy(ucLine, 2, 9) = 'BTNHEIGHT') and (piButtonSize in AItems) then
FButtonHeight := StrToIntDef(Copy(Line, 11, MaxInt), FButtonHeight) FButtonHeight := StrToIntDef(Copy(Line, 11, MaxInt), FButtonHeight)
else else
if (Copy(Line, 2, 9) = 'BTNBORDER') and (piButtonBorder in AItems) then if (Copy(ucLine, 2, 9) = 'BTNBORDER') and (piButtonBorder in AItems) then
begin begin
Delete(Line, 1, 11); Delete(Line, 1, 11);
ParseColor(Line, C, steps, clrName); ParseColor(Line, C, steps, clrName);
FButtonBorderColor := C; FButtonBorderColor := C;
end else end else
if (Copy(Line, 2, 7) = 'FLIPPED') and (piFlipped in AItems) then if (Copy(ucLine, 2, 7) = 'FLIPPED') and (piFlipped in AItems) then
begin begin
Delete(Line, 1, 9); Delete(ucLine, 1, 9);
case Line of case ucLine of
'TRUE' : FFlipped := true; 'TRUE' : FFlipped := true;
'FALSE': FFlipped := false; 'FALSE': FFlipped := false;
end; end;
end else end else
if (Copy(Line, 2, 7) = 'SELKIND') and (piSelKind in AItems) then if (Copy(ucLine, 2, 7) = 'SELKIND') and (piSelKind in AItems) then
begin begin
Delete(Line, 1, 9); Delete(ucLine, 1, 9);
for sk in TPaletteSelectionKind do for sk in TPaletteSelectionKind do
if Line = SELKIND_NAMES[sk] then if ucLine = SELKIND_NAMES[sk] then
begin begin
FSelectionKind := sk; FSelectionKind := sk;
break; break;
end; end;
end else end else
if (Copy(Line, 2, 8) = 'SELCOLOR') and (piSelColor in AItems) then if (Copy(ucLine, 2, 8) = 'SELCOLOR') and (piSelColor in AItems) then
begin begin
Delete(Line, 1, 10); Delete(Line, 1, 10);
ParseColor(Line, C, steps, clrName); ParseColor(Line, C, steps, clrName);
FSelectionColor := C; FSelectionColor := C;
end else end else
if (Copy(Line, 2, 7) = 'BLENDWB') and (piColors in AItems) then if (Copy(ucLine, 2, 7) = 'BLENDWB') and (piColors in AItems) then
begin begin
Delete(Line, 1, 8); Delete(Line, 1, 8);
ParseColor(Line, C, steps, clrName); ParseColor(Line, C, steps, clrName);