📄 sskinmanager.pas
字号:
SmallCheckBoxGrayed := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_SmallBoxGrayed);
end
else begin
CheckBoxChecked := -1;
CheckBoxUnChecked := -1;
CheckBoxGrayed := -1;
RadioButtonChecked := -1;
RadioButtonUnChecked := -1;
RadioButtonGrayed := -1;
SmallCheckBoxChecked := -1;
SmallCheckBoxUnChecked := -1;
SmallCheckBoxGrayed := -1;
end;
// ComboBox
ComboBtnIndex := GetSkinIndex(s_ComboBtn);
ComboBtnBorder := GetMaskIndex(s_ComboBtn, s_BordersMask);
ComboBtnBG := GetTextureIndex(ComboBtnIndex, s_ComboBtn, s_Pattern);
ComboBtnBGHot := GetTextureIndex(ComboBtnIndex, s_ComboBtn, s_HotPattern);
ComboGlyph := GetMaskIndex(s_ComboBox, s_ItemGlyph);
// Tabs
IndexTabTop := GetSkinIndex(s_TABTOP);
IndexTabBottom := GetSkinIndex(s_TABBOTTOM);
IndexTabLeft := GetSkinIndex(s_TABLEFT);
IndexTabRight := GetSkinIndex(s_TABRIGHT);
MaskTabTop := GetMaskIndex(IndexTabTop, s_TABTOP, s_BordersMask);
MaskTabBottom := GetMaskIndex(IndexTabTop, s_TABBOTTOM, s_BordersMask);
MaskTabLeft := GetMaskIndex(IndexTabTop, s_TABLEFT, s_BordersMask);
MaskTabRight := GetMaskIndex(IndexTabTop, s_TABRIGHT, s_BordersMask);
IndexScrollTop := GetSkinIndex(s_SCROLLBTNTOP);
IndexScrollBottom := GetSkinIndex(s_SCROLLBTNBOTTOM);
IndexScrollLeft := GetSkinIndex(s_SCROLLBTNLEFT);
IndexScrollRight := GetSkinIndex(s_SCROLLBTNRIGHT);
IndexSliderVert := GetSkinIndex(s_SCROLLSLIDERV);
IndexSliderHorz := GetSkinIndex(s_SCROLLSLIDERH) ;
MaskScrollTop := GetMaskIndex(IndexScrollTop, s_SCROLLBTNTOP, s_BordersMask);
if IndexScrollTop > -1 then begin
MaskArrowTop := GetMaskIndex(IndexScrollTop, s_ScrollBtntop, s_ItemGlyph);
end;
MaskScrollBottom := GetMaskIndex(IndexScrollBottom, s_SCROLLBTNBOTTOM, s_BordersMask);
if IndexScrollBottom > -1 then begin
MaskArrowBottom := GetMaskIndex(IndexScrollBottom, s_ScrollBtnBottom, s_ItemGlyph);
end;
MaskScrollLeft := GetMaskIndex(IndexScrollLeft, s_SCROLLBTNLEFT, s_BordersMask);
if IndexScrollLeft > -1 then begin
MaskArrowLeft := GetMaskIndex(IndexScrollLeft, s_ScrollBtnLeft, s_ItemGlyph);
end;
MaskScrollRight := GetMaskIndex(IndexScrollRight, s_SCROLLBTNRIGHT, s_BordersMask);
if IndexScrollRight > -1 then begin
MaskArrowRight := GetMaskIndex(IndexScrollRight, s_ScrollBtnRight, s_ItemGlyph);
end;
MaskSliderVert := GetMaskIndex(IndexSliderVert, s_SCROLLSLIDERV, s_BordersMask);
MaskSliderHorz := GetMaskIndex(IndexSliderHorz, s_SCROLLSLIDERH, s_BordersMask);
if IndexSLiderVert > -1 then begin
MaskSliderGlyphVert := GetMaskIndex(IndexSLiderVert, s_ScrollSLiderV, s_ItemGlyph);
end;
if IndexSLiderHorz > -1 then begin
MaskSliderGlyphHorz := GetMaskIndex(IndexSLiderHorz, s_ScrollSLiderH, s_ItemGlyph);
end;
IndexBGScrollTop := GetMaskIndex(IndexScrollTop, s_ScrollBtnTop, s_PatternFile);
IndexBGHotScrollTop := GetMaskIndex(IndexScrollTop, s_ScrollBtnTop, s_HotPatternFile);
IndexBGScrollBottom := GetMaskIndex(IndexScrollBottom, s_ScrollBtnBottom, s_PatternFile);
IndexBGHotScrollBottom := GetMaskIndex(IndexScrollBottom, s_ScrollBtnBottom, s_HotPatternFile);
IndexBGScrollLeft := GetMaskIndex(IndexScrollLeft, s_ScrollBtnLeft, s_PatternFile);
IndexBGHotScrollLeft := GetMaskIndex(IndexScrollLeft, s_ScrollBtnLeft, s_HotPatternFile);
IndexBGScrollRight := GetMaskIndex(IndexScrollRight, s_ScrollBtnRight, s_PatternFile);
IndexBGHotScrollRight := GetMaskIndex(IndexScrollRight, s_ScrollBtnRight, s_HotPatternFile);
ScrollSliderBGHorz := GetMaskIndex(IndexSLiderHorz, s_ScrollSLiderH, s_PatternFile);
ScrollSliderBGHotHorz := GetMaskIndex(IndexSLiderHorz, s_ScrollSLiderH, s_HotPatternFile);
ScrollSliderBGVert := GetMaskIndex(IndexSLiderVert, s_ScrollSLiderV, s_PatternFile);
ScrollSliderBGHotVert := GetMaskIndex(IndexSLiderVert, s_ScrollSLiderV, s_HotPatternFile);
//ScrollBars
IndexScrollBar1H := GetSkinIndex(s_ScrollBar1H);
IndexScrollBar1V := GetSkinIndex(s_ScrollBar1V);
IndexScrollBar2H := GetSkinIndex(s_ScrollBar2H);
IndexScrollBar2V := GetSkinIndex(s_ScrollBar2V);
MaskScrollBar1H := GetMaskIndex(IndexScrollBar1H, s_ScrollBar1H, s_BordersMask);
MaskScrollBar1V := GetMaskIndex(IndexScrollBar1V, s_ScrollBar1V, s_BordersMask);
MaskScrollBar2H := GetMaskIndex(IndexScrollBar2H, s_ScrollBar2H, s_BordersMask);
MaskScrollBar2V := GetMaskIndex(IndexScrollBar2V, s_ScrollBar2V, s_BordersMask);
BGScrollBar1H := GetMaskIndex(IndexScrollBar1H, s_ScrollBar1H, s_PatternFile);
BGScrollBar1V := GetMaskIndex(IndexScrollBar1V, s_ScrollBar1V, s_PatternFile);
BGScrollBar2H := GetMaskIndex(IndexScrollBar2H, s_ScrollBar2H, s_PatternFile);
BGScrollBar2V := GetMaskIndex(IndexScrollBar2V, s_ScrollBar2V, s_PatternFile);
BGHotScrollBar1H := GetMaskIndex(IndexScrollBar1H, s_ScrollBar1H, s_HotPatternFile);
BGHotScrollBar1V := GetMaskIndex(IndexScrollBar1V, s_ScrollBar1V, s_HotPatternFile);
BGHotScrollBar2H := GetMaskIndex(IndexScrollBar2H, s_ScrollBar2H, s_HotPatternFile);
BGHotScrollBar2V := GetMaskIndex(IndexScrollBar2V, s_ScrollBar2V, s_HotPatternFile);
end;
end;
procedure TsSkinManager.Loaded;
begin
inherited;
if FSkinDirectory = '' then FSkinDirectory := DefSkinsDir;
if FMenuSupport.IcoLineSkin = '' then FMenuSupport.IcoLineSkin := s_MenuIcoLine;
LoadThirdNames(Self);
if Active and (SkinName <> '') then begin
SendNewSkin; // v4.72
end;
end;
procedure TsSkinManager.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited Notification(AComponent, Operation); // added v3.73 fixing of the error with TsSkinManager closing
{ if (DefaultManager = Self) and SkinData.Active and (AComponent is TMenuItem) and not (csDesigning in ComponentState) then begin
FSkinableMenus.HookItem(TMenuItem(AComponent), Operation = opInsert);
end;
if (DefaultManager = Self) and SkinData.Active and (AComponent is TMainMenu) and not (csDesigning in ComponentState) then begin
FSkinableMenus.InitMenuLine(TMainMenu(AComponent), Operation = opInsert);
end;}
end;
procedure TsSkinManager.SaveToIni(Index: integer; sf: TMemIniFile);
var
gd : TsSkinGeneral;
i : integer;
s, SectionName : string;
begin
for i := 0 to InternalSkins[Index].GeneralData.Count - 1 do begin
gd := InternalSkins[Index].GeneralData.Items[i];
if gd.SectionName = '' then Continue;
SectionName := gd.SectionName;
s := gd.ParentClass;
WriteIniStr(SectionName, s_ParentClass, s, sf);
s := IntToStr(gd.Color);
WriteIniStr(SectionName, s_Color, s, sf);
s := IntToStr(ord(gd.Bevel));
WriteIniStr(SectionName, s_Bevel, s, sf);
s := IntToStr(gd.ShadowBlur);
WriteIniStr(SectionName, s_ShadowBlur, s, sf);
s := IntToStr(gd.ShadowOffset);
WriteIniStr(SectionName, s_ShadowOffset, s, sf);
s := IntToStr(gd.ShadowColor);
WriteIniStr(SectionName, s_ShadowColor, s, sf);
s := IntToStr(gd.ShadowTransparency);
WriteIniStr(SectionName, s_ShadowTransparency, s, sf);
s := iff(gd.ShadowEnabled, 'TRUE', 'FALSE');
WriteIniStr(SectionName, s_ShadowEnabled, s, sf);
s := iff(gd.ReservedBoolean, 'TRUE', 'FALSE');
WriteIniStr(SectionName, s_ReservedBoolean, s, sf);
s := ExtractWord(1, gd.FontColor, [' ']);
WriteIniStr(SectionName, s_FontColor, s, sf);
s := ExtractWord(2, gd.FontColor, [' ']);
WriteIniStr(SectionName, s_TCLeft, s, sf);
s := ExtractWord(3, gd.FontColor, [' ']);
WriteIniStr(SectionName, s_TCTop, s, sf);
s := ExtractWord(4, gd.FontColor, [' ']);
WriteIniStr(SectionName, s_TCRight, s, sf);
s := ExtractWord(5, gd.FontColor, [' ']);
WriteIniStr(SectionName, s_TCBottom, s, sf);
s := ExtractWord(1, gd.HotFontColor, [' ']);
WriteIniStr(SectionName, s_HotFontColor, s, sf);
s := ExtractWord(2, gd.HotFontColor, [' ']);
WriteIniStr(SectionName, s_HotTCLeft, s, sf);
s := ExtractWord(3, gd.HotFontColor, [' ']);
WriteIniStr(SectionName, s_HotTCTop, s, sf);
s := ExtractWord(4, gd.HotFontColor, [' ']);
WriteIniStr(SectionName, s_HotTCRight, s, sf);
s := ExtractWord(5, gd.HotFontColor, [' ']);
WriteIniStr(SectionName, s_HotTCBottom, s, sf);
s := IntToStr(gd.Transparency);
WriteIniStr(SectionName, s_Transparency, s, sf);
s := IntToStr(gd.GradientPercent);
WriteIniStr(SectionName, s_GradientPercent, s, sf);
s := IntToStr(gd.ImagePercent);
WriteIniStr(SectionName, s_ImagePercent, s, sf);
s := (gd.GradientData);
WriteIniStr(SectionName, s_GradientData, s, sf);
s := iff(gd.ShowFocus, 'TRUE', 'FALSE');
WriteIniStr(SectionName, s_ShowFocus, s, sf);
s := iff(gd.FadingEnabled, 'TRUE', 'FALSE');
WriteIniStr(SectionName, s_FadingEnabled, s, sf);
s := IntToStr(gd.FadingIntervalIn);
WriteIniStr(SectionName, s_FadingIntervalIn, s, sf);
s := IntToStr(gd.FadingIntervalOut);
WriteIniStr(SectionName, s_FadingIntervalOut, s, sf);
s := IntToStr(gd.FadingIterations);
WriteIniStr(SectionName, s_FadingIterations, s, sf);
s := IntToStr(gd.HotColor);
WriteIniStr(SectionName, s_HotColor, s, sf);
s := IntToStr(gd.HotTransparency);
WriteIniStr(SectionName, s_HotTransparency, s, sf);
s := IntToStr(ord(gd.HotBevel));
WriteIniStr(SectionName, s_HotBevel, s, sf);
s := IntToStr(gd.HotGradientPercent);
WriteIniStr(SectionName, s_HotGradientPercent, s, sf);
s := gd.HotGradientData;
WriteIniStr(SectionName, s_HotGradientData, s, sf);
s := IntToStr(gd.HotImagePercent);
WriteIniStr(SectionName, s_HotImagePercent, s, sf);
s := IntToStr(gd.BorderColor1);
WriteIniStr(SectionName, s_BorderColor1, s, sf);
s := IntToStr(gd.BorderColor2);
WriteIniStr(SectionName, s_BorderColor2, s, sf);
end;
end;
procedure TsSkinManager.SendNewSkin;
var
M : TMessage;
i : integer;
begin
if not (csDesigning in ComponentState) and not (csLoading in ComponentState) {and (Application.MainForm <> nil)} then LockForms(Self);
if SkinableMenus <> nil then begin
SkinableMenus.SkinBorderWidth := -1;
end;
SkinData.Active := False;
RestrictDrawing := True;
InitConstantIndexes; // v4.34
M.Msg := SM_ALPHACMD;
M.WParam := MakeWParam(0, AC_SETNEWSKIN);
M.LParam := longint(Self);
M.Result := 0;
if csDesigning in ComponentState
then for i := 0 to Screen.FormCount - 1 do begin
if (Screen.Forms[i].Name = '') or (Screen.Forms[i].Name = 'AppBuilder') or (Screen.Forms[i].Name = 'PropertyInspector') then Continue;
SendToProvider(Screen.Forms[i], M);
AlphaBroadCast(Screen.Forms[i], M);
SendToHooked(M);
end
else AppBroadCastS(M);
RestrictDrawing := False;
SkinData.Active := True;
if (DefaultManager = Self) and not GlobalHookInstalled then InstallHook;
RepaintForms;
{$IFDEF DEVEX}
if RootLookAndFeel.Kind <> lfOffice11 then begin
OldRootLookAndFeel := RootLookAndFeel.Kind;
// RootLookAndFeel.SkinPainter := TcxACLookAndFeelPainter;
end;
RootLookAndFeel.Kind := lfStandard;
RootLookAndFeel.Kind := lfOffice11;
{$ENDIF}
end;
procedure TsSkinManager.SendRemoveSkin;
var
M : TMessage;
i : integer;
begin
{$IFDEF DEVEX}
RootLookAndFeel.Kind := OldRootLookAndFeel;
{$ENDIF}
aSkinRemoving := True;
UninstallHook;
SkinData.Active := False;
M.Msg := SM_ALPHACMD;
M.WParam := MakeWParam(0, AC_REMOVESKIN);
M.LParam := longint(Self);
M.Result := 0;
if csDesigning in ComponentState then begin
for i := 0 to Screen.FormCount - 1 do begin
if (Screen.Forms[i].Name = '') or
(Screen.Forms[i].Name = 'AppBuilder') or
(pos('EditWindow_', Screen.Forms[i].Name)> 0) or
(pos('DockSite', Screen.Forms[i].Name)> 0) or
(Screen.Forms[i].Name = 'PropertyInspector') then Continue;
SendToProvider(Screen.Forms[i], M);
AlphaBroadCast(Screen.Forms[i], M);
SendToHooked(M);
end;
end
else begin
AppBroadCastS(M);
end;
FreeBitmaps;
FreeJpegs;
SetLength(gd, 0);
aSkinRemoving := False;
end;
procedure TsSkinManager.SetActive(const Value: boolean);
begin
if FActive <> Value then begin
FActive := Value;
if not Value then begin
// if Assigned(FOnBeforeChange) then FOnBeforeChange(Self);
if not (csLoading in ComponentState) then SendRemoveSkin;
InitConstantIndexes;
// if Assigned(FOnAfterChange) then FOnAfterChange(Self);
end
else begin
SkinName := FSkinName;
end;
end;
end;
procedure TsSkinManager.SetBuiltInSkins(const Value: TsStoredSkins);
begin
FBuiltInSkins.Assign(Value);
end;
procedure TsSkinManager.SetCommonSections(const Value: TStringList);
var
i : integer;
s : string;
begin
FCommonSections.Assign(Value);
for i := 0 to FCommonSections.Count - 1 do begin
s := FCommonSections[i];
if (s <> '') and (s[1] <> ';') then FCommonSections[i] := acntUtils.DelChars(s, ' ');
end;
SkinName := SkinName;
end;
procedure TsSkinManager.SetSkinDirectory(const Value: string);
begin
if FSkinDirectory <> Value then begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -