📄 sskinmanager.pas
字号:
end;
if pa[l - 1].Img.Width < 1 then begin
FreeAndNil(pa[l - 1].Img);
SetLength(pa, l - 1);
end;
l := Length(ma);
if l > 0 then begin
for i := 0 to l - 1 do begin
if (ma[i].PropertyName = s) and (ma[i].ClassName = UpperCase(skinSection)) then begin
FreeAndNil(ma[i].Bmp);
l := Length(ma) - 1;
if l <> i then begin
ma[i].Bmp := ma[l].Bmp ;
ma[i].BorderWidth := ma[l].BorderWidth ;
ma[i].ClassName := ma[l].ClassName ;
ma[i].DrawMode := ma[l].DrawMode ;
ma[i].ImageCount := ma[l].ImageCount ;
ma[i].Manager := ma[l].Manager ;
ma[i].MaskType := ma[l].MaskType ;
ma[i].PropertyName := ma[l].PropertyName;
ma[i].R := ma[l].R ;
ma[i].WT := ma[l].WT ;
ma[i].WL := ma[l].WL ;
ma[i].WR := ma[l].WR ;
ma[i].WB := ma[l].WB ;
end;
SetLength(ma, l);
Break;
end;
end;
end;
end;
end;
end
// If property is not background texture
else begin
if pos('.BMP', FileName) > 0 then begin
l := Length(ma);
if l > 0 then for i := 0 to l - 1 do if (ma[i].PropertyName = s) and (ma[i].ClassName = UpperCase(skinSection)) then begin
ma[i].Bmp.LoadFromFile(FileName);
Result := True;
Exit
end;
end;
end;
end;
end;
procedure ChangeSkinSaturation(sManager : TsSkinManager; Value : integer);
var
S1 : PRGBArray;
i, l, j, w, h, x, y : integer;
C : TsColor;
begin
if Value = 0 then Exit;
Value := - Value mod 101;
with sManager do begin
if Assigned(MasterBitmap) then begin
h := MasterBitmap.Height - 1;
w := MasterBitmap.Width - 1;
for y := 0 to h do begin
S1 := MasterBitmap.ScanLine[y];
for x := 0 to w do with S1[X] do begin
C.R := R; C.G := G; C.B := B;
if (C.C = clFuchsia) or ((C.R = C.G) and (C.R = C.B)) then Continue;
C.C := ChangeSaturation(C.C, Value);
R := C.R; G := C.G; B := C.B
end
end;
end;
l := Length(ma);
for i := 0 to l - 1 do if Assigned(ma[i].Bmp) then begin
h := ma[i].Bmp.Height - 1;
w := ma[i].Bmp.Width - 1;
ma[i].Bmp.PixelFormat := pf24bit;
for y := 0 to h do begin
S1 := ma[i].Bmp.ScanLine[y];
for x := 0 to w do with S1[X] do begin
C.R := R; C.G := G; C.B := B;
if (C.C = clFuchsia) or ((C.R = C.G) and (C.R = C.B)) then Continue;
C.C := ChangeSaturation(C.C, Value);
R := C.R; G := C.G; B := C.B
end
end;
end;
l := Length(gd);
for i := 0 to l - 1 do begin
gd[i].Color := ChangeSaturation(gd[i].Color, Value);
gd[i].HotColor := ChangeSaturation(gd[i].HotColor, Value);
if gd[i].FontColor[1] <> -1 then gd[i].FontColor[1] := ChangeSaturation(gd[i].FontColor[1], Value);
if gd[i].FontColor[2] <> -1 then gd[i].FontColor[2] := ChangeSaturation(gd[i].FontColor[2], Value);
if gd[i].FontColor[3] <> -1 then gd[i].FontColor[3] := ChangeSaturation(gd[i].FontColor[3], Value);
if gd[i].FontColor[4] <> -1 then gd[i].FontColor[4] := ChangeSaturation(gd[i].FontColor[4], Value);
if gd[i].FontColor[5] <> -1 then gd[i].FontColor[5] := ChangeSaturation(gd[i].FontColor[5], Value);
if gd[i].HotFontColor[1] <> -1 then gd[i].HotFontColor[1] := ChangeSaturation(gd[i].HotFontColor[1], Value);
if gd[i].HotFontColor[2] <> -1 then gd[i].HotFontColor[2] := ChangeSaturation(gd[i].HotFontColor[2], Value);
if gd[i].HotFontColor[3] <> -1 then gd[i].HotFontColor[3] := ChangeSaturation(gd[i].HotFontColor[3], Value);
if gd[i].HotFontColor[4] <> -1 then gd[i].HotFontColor[4] := ChangeSaturation(gd[i].HotFontColor[4], Value);
if gd[i].HotFontColor[5] <> -1 then gd[i].HotFontColor[5] := ChangeSaturation(gd[i].HotFontColor[5], Value);
w := WordCount(gd[i].GradientData, [';']) div 5;
for j := 0 to w - 1 do begin
gd[i].GradientArray[j].Color1 := ChangeSaturation(gd[i].GradientArray[j].Color1, Value);
gd[i].GradientArray[j].Color2 := ChangeSaturation(gd[i].GradientArray[j].Color2, Value);
end;
w := Length(gd[i].HotGradientArray);
for j := 0 to w - 1 do begin
gd[i].HotGradientArray[j].Color1 := ChangeSaturation(gd[i].HotGradientArray[j].Color1, Value);
gd[i].HotGradientArray[j].Color2 := ChangeSaturation(gd[i].HotGradientArray[j].Color2, Value);
end;
end;
sManager.SkinData.Shadow1Color := ChangeSaturation(sManager.SkinData.Shadow1Color, Value);
sManager.SkinData.BorderColor := ChangeSaturation(sManager.SkinData.BorderColor, Value);
end;
end;
procedure ChangeSkinBrightness(sManager : TsSkinManager; Value : integer);
var
S1 : PRGBArray;
i, l, j, w, h, x, y : integer;
C : TsColor;
begin
if Value = 0 then Exit;
with sManager do begin
if Assigned(MasterBitmap) then begin
h := MasterBitmap.Height - 1;
w := MasterBitmap.Width - 1;
for y := 0 to h do begin
S1 := MasterBitmap.ScanLine[y];
for x := 0 to w do with S1[X] do begin
C.R := R; C.G := G; C.B := B;
if (C.C = clFuchsia) then Continue;
C.C := ChangeBrightness(C.C, Value);
R := C.R; G := C.G; B := C.B
end
end;
end;
l := Length(ma);
for i := 0 to l - 1 do if Assigned(ma[i].Bmp) then begin
h := ma[i].Bmp.Height - 1;
w := ma[i].Bmp.Width - 1;
ma[i].Bmp.PixelFormat := pf24bit;
for y := 0 to h do begin
S1 := ma[i].Bmp.ScanLine[y];
for x := 0 to w do with S1[X] do begin
C.R := R; C.G := G; C.B := B;
if (C.C = clFuchsia) then Continue;
C.C := ChangeBrightness(C.C, Value);
R := C.R; G := C.G; B := C.B
end
end;
end;
l := Length(gd);
for i := 0 to l - 1 do begin
gd[i].Color := ChangeBrightness(gd[i].Color, Value);
gd[i].HotColor := ChangeBrightness(gd[i].HotColor, Value);
if gd[i].FontColor[1] <> -1 then gd[i].FontColor[1] := ChangeBrightness(gd[i].FontColor[1], Value);
if gd[i].FontColor[2] <> -1 then gd[i].FontColor[2] := ChangeBrightness(gd[i].FontColor[2], Value);
if gd[i].FontColor[3] <> -1 then gd[i].FontColor[3] := ChangeBrightness(gd[i].FontColor[3], Value);
if gd[i].FontColor[4] <> -1 then gd[i].FontColor[4] := ChangeBrightness(gd[i].FontColor[4], Value);
if gd[i].FontColor[5] <> -1 then gd[i].FontColor[5] := ChangeBrightness(gd[i].FontColor[5], Value);
if gd[i].HotFontColor[1] <> -1 then gd[i].HotFontColor[1] := ChangeBrightness(gd[i].HotFontColor[1], Value);
if gd[i].HotFontColor[2] <> -1 then gd[i].HotFontColor[2] := ChangeBrightness(gd[i].HotFontColor[2], Value);
if gd[i].HotFontColor[3] <> -1 then gd[i].HotFontColor[3] := ChangeBrightness(gd[i].HotFontColor[3], Value);
if gd[i].HotFontColor[4] <> -1 then gd[i].HotFontColor[4] := ChangeBrightness(gd[i].HotFontColor[4], Value);
if gd[i].HotFontColor[5] <> -1 then gd[i].HotFontColor[5] := ChangeBrightness(gd[i].HotFontColor[5], Value);
w := WordCount(gd[i].GradientData, [';']) div 5;
for j := 0 to w - 1 do begin
gd[i].GradientArray[j].Color1 := ChangeBrightness(gd[i].GradientArray[j].Color1, Value);
gd[i].GradientArray[j].Color2 := ChangeBrightness(gd[i].GradientArray[j].Color2, Value);
end;
w := Length(gd[i].HotGradientArray);
for j := 0 to w - 1 do begin
gd[i].HotGradientArray[j].Color1 := ChangeBrightness(gd[i].HotGradientArray[j].Color1, Value);
gd[i].HotGradientArray[j].Color2 := ChangeBrightness(gd[i].HotGradientArray[j].Color2, Value);
end;
end;
end;
end;
procedure ChangeSkinHue(sManager : TsSkinManager; Value : integer);
var
S1 : PRGBArray;
i, l, j, w, h, x, y : integer;
C : TsColor;
begin
if Value = 0 then Exit;
with sManager do begin
if Assigned(MasterBitmap) then begin
h := MasterBitmap.Height - 1;
w := MasterBitmap.Width - 1;
for y := 0 to h do begin
S1 := MasterBitmap.ScanLine[y];
for x := 0 to w do with S1[X] do begin
C.R := R; C.G := G; C.B := B;
if (C.C = clFuchsia) or ((C.R = C.G) and (C.R = C.B)) then Continue;
C.C := ChangeHue(Value, C.C);
R := C.R; G := C.G; B := C.B
end
end;
end;
l := Length(ma);
for i := 0 to l - 1 do if Assigned(ma[i].Bmp) then begin
h := ma[i].Bmp.Height - 1;
w := ma[i].Bmp.Width - 1;
ma[i].Bmp.PixelFormat := pf24bit;
for y := 0 to h do begin
S1 := ma[i].Bmp.ScanLine[y];
for x := 0 to w do with S1[X] do begin
C.R := R; C.G := G; C.B := B;
if (C.C = clFuchsia) or ((C.R = C.G) and (C.R = C.B)) then Continue;
C.C := ChangeHue(Value, C.C);
R := C.R; G := C.G; B := C.B
end
end;
end;
l := Length(gd);
for i := 0 to l - 1 do begin
gd[i].Color := ChangeHue(Value, gd[i].Color);
gd[i].HotColor := ChangeHue(Value, gd[i].HotColor);
if gd[i].FontColor[1] <> -1 then gd[i].FontColor[1] := ChangeHue(Value, gd[i].FontColor[1]);
if gd[i].FontColor[2] <> -1 then gd[i].FontColor[2] := ChangeHue(Value, gd[i].FontColor[2]);
if gd[i].FontColor[3] <> -1 then gd[i].FontColor[3] := ChangeHue(Value, gd[i].FontColor[3]);
if gd[i].FontColor[4] <> -1 then gd[i].FontColor[4] := ChangeHue(Value, gd[i].FontColor[4]);
if gd[i].FontColor[5] <> -1 then gd[i].FontColor[5] := ChangeHue(Value, gd[i].FontColor[5]);
if gd[i].HotFontColor[1] <> -1 then gd[i].HotFontColor[1] := ChangeHue(Value, gd[i].HotFontColor[1]);
if gd[i].HotFontColor[2] <> -1 then gd[i].HotFontColor[2] := ChangeHue(Value, gd[i].HotFontColor[2]);
if gd[i].HotFontColor[3] <> -1 then gd[i].HotFontColor[3] := ChangeHue(Value, gd[i].HotFontColor[3]);
if gd[i].HotFontColor[4] <> -1 then gd[i].HotFontColor[4] := ChangeHue(Value, gd[i].HotFontColor[4]);
if gd[i].HotFontColor[5] <> -1 then gd[i].HotFontColor[5] := ChangeHue(Value, gd[i].HotFontColor[5]);
w := WordCount(gd[i].GradientData, [';']) div 5;
for j := 0 to w - 1 do begin
gd[i].GradientArray[j].Color1 := ChangeHue(Value, gd[i].GradientArray[j].Color1);
gd[i].GradientArray[j].Color2 := ChangeHue(Value, gd[i].GradientArray[j].Color2);
end;
w := Length(gd[i].HotGradientArray);
for j := 0 to w - 1 do begin
gd[i].HotGradientArray[j].Color1 := ChangeHue(Value, gd[i].HotGradientArray[j].Color1);
gd[i].HotGradientArray[j].Color2 := ChangeHue(Value, gd[i].HotGradientArray[j].Color2);
end;
end;
sManager.SkinData.Shadow1Color := ChangeHue(Value, sManager.SkinData.Shadow1Color);
sManager.SkinData.BorderColor := ChangeHue(Value, sManager.SkinData.BorderColor);
end;
end;
procedure LoadThirdNames(sm : TsSkinManager; Overwrite : boolean = False);
var
i : integer;
s : string;
begin
if (sm.ThirdParty.FThirdEdits = 'TButton') or (sm.ThirdParty.ThirdButtons = 'TBitBtn') then with sm.ThirdParty do begin // Correct 5.42 error
s := FThirdEdits ;
FThirdEdits := FThirdPanels ;
FThirdPanels := FThirdTreeViews ;
FThirdTreeViews := FThirdComboBoxes ;
FThirdComboBoxes := FThirdCheckBoxes ;
FThirdCheckBoxes := FThirdBitBtns ;
FThirdBitBtns := FThirdButtons ;
FThirdButtons := s ;
s := FThirdListViews ;
FThirdListViews := FThirdGrids ;
FThirdGrids := FThirdGroupBoxes ;
FThirdGroupBoxes := s ;
s := FThirdGridEh ;
FThirdGridEh := FThirdVirtualTrees;
FThirdVirtualTrees := sl_Third_VirtualTree;
end;
for i := 0 to ord(acLastSupportedType) do begin
if Overwrite or (sm.ThirdParty.GetString(i) = '') then sm.ThirdParty.SetString(i, acThirdNames[i]);
sm.ThirdLists[i].Text := sm.ThirdParty.GetString(i);
end;
end;
procedure UpdateThirdNames(sm : TsSkinManager);
var
i : integer;
begin
for i := 0 to ord(acLastSupportedType) do sm.ThirdParty.SetString(i, sm.ThirdLists[i].Text);
end;
{ TsSkinManager }
procedure TsSkinManager.AfterConstruction;
begin
inherited;
LoadThirdNames(Self);
if FSkinDirectory = '' then begin
FSkinDirectory := DefSkinsDir;
end;
end;
constructor TsSkinManager.Create(AOwner: TComponent);
var
i, l : integer;
begin
inherited Create(AOwner);
FThirdParty := ThirdPartyList.Create;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -