📄 sskinmanager.pas
字号:
IntToStr(InternalSkins[Index].Patterns[i].R.Bottom) + '),3,1';
WriteIniStr(InternalSkins[Index].Patterns[i].SectionName, InternalSkins[Index].Patterns[i].PropertyName, s, sf); v402}
end;
end;
// Extract Ini
SaveToIni(Index, sf);
finally
sf.UpdateFile;
FreeAndNil(sf);
end;
end;
procedure TsSkinManager.ExtractInternalSkin(const NameOfSkin, DestDir: string);
var
i : integer;
Executed : boolean;
begin
Executed := False;
for i := 0 to InternalSkins.Count - 1 do begin
if InternalSkins[i].Name = NameOfskin then begin
if DirectoryExists(Destdir) then begin
ExtractByIndex(i, Destdir);
{$IFNDEF ALITE}
end
else begin
ShowError('Directory with such name do not exists.');
{$ENDIF}
end;
Executed := True;
end;
end;
if not Executed then begin
{$IFNDEF ALITE}
ShowError('Skin with such name do not exists.');
{$ENDIF}
end;
end;
function TsSkinManager.GetExternalSkinNames(sl: TStrings; SkinType : TacSkinTypes = stAllSkins): string;
var
FileInfo: TSearchRec;
DosCode: Integer;
s : string;
SkinPath : string;
stl : TStringList;
begin
Result := '';
SkinPath := GetFullskinDirectory;
sl.Clear;
stl := TStringList.Create;
// External skins names loading
if DirectoryExists(SkinPath) then begin
s := SkinPath + '\*.*';
DosCode := FindFirst(s, faDirectory, FileInfo);
try
while DosCode = 0 do begin
if (FileInfo.Name[1] <> '.') then begin
if (SkinType in [stUnpacked, stAllSkins]) and (FileInfo.Attr and faDirectory = faDirectory) and FileExists(SkinPath + '\' + FileInfo.Name + '\' + OptionsDatName) then begin
stl.Add(FileInfo.Name);
if Result = '' then Result := FileInfo.Name;
end
else if (SkinType in [stPacked, stAllSkins]) and (FileInfo.Attr and faDirectory <> faDirectory) and (ExtractFileExt(FileInfo.Name) = '.' + acSkinExt) then begin
s := ExtractWord(1, FileInfo.Name, ['.']);
stl.Add(s);
if Result = '' then Result := s;
end;
end;
DosCode := FindNext(FileInfo);
end;
finally
FindClose(FileInfo);
end;
end;
stl.Sort;
sl.Assign(stl);
FreeAndNil(stl);
end;
function TsSkinManager.GetFullSkinDirectory: string;
var
s : string;
begin
Result := SkinDirectory;
if (pos('..', Result) = 1) then begin
s := GetAppPath;
Delete(s, Length(s), 1);
while (s[Length(s)] <> '/') and (s[Length(s)] <> '\') do begin
Delete(s, Length(s), 1);
end;
Delete(Result, 1, 3);
Result := s + Result;
end
else if (pos('.\', Result) = 1) or (pos('./', Result) = 1) then begin
Delete(Result, 1, 2);
Result := GetAppPath + Result;
end
else if (pos(':', Result) < 1) and (pos('\\', Result) < 1) then begin
Result := GetAppPath + Result;
end;
NormalDir(Result);
end;
function TsSkinManager.GetGlobalColor: TColor;
begin
if (ConstData.IndexGlobalInfo > -1) and (ConstData.IndexGlobalInfo <= Length(gd) - 1) then Result := ColorToRGB(gd[ConstData.IndexGlobalInfo].Color) else Result := ColorToRGB(clBtnFace);
end;
function TsSkinManager.GetGlobalFontColor: TColor;
begin
if (ConstData.IndexGlobalInfo > -1) and (ConstData.IndexGlobalInfo <= Length(gd) - 1) then Result := ColorToRGB(gd[ConstData.IndexGlobalInfo].FontColor[1]) else Result := clFuchsia;
end;
function TsSkinManager.GetSkinNames(sl: TStrings; SkinType : TacSkinTypes = stAllSkins) : string;
var
FileInfo: TSearchRec;
DosCode: Integer;
s : string;
SkinPath : string;
stl : TStringList;
begin
Result := '';
SkinPath := GetFullskinDirectory;
sl.Clear;
stl := TStringList.Create;
// Internal skins names loading
if InternalSkins.Count > 0 then begin
for DosCode := 0 to InternalSkins.Count - 1 do begin
stl.Add(InternalSkins[DosCode].Name);
if Result = '' then Result := InternalSkins[DosCode].Name;
end;
end;
// External skins names loading
if DirectoryExists(SkinPath) then begin
s := SkinPath + '\*.*';
DosCode := FindFirst(s, faDirectory, FileInfo);
try
while DosCode = 0 do begin
if (FileInfo.Name[1] <> '.') then begin
if (SkinType in [stUnpacked, stAllSkins]) and (FileInfo.Attr and faDirectory = faDirectory) and FileExists(SkinPath + '\' + FileInfo.Name + '\' + OptionsDatName) then begin
stl.Add(FileInfo.Name);
if Result = '' then Result := FileInfo.Name;
end
else if (SkinType in [stPacked, stAllSkins]) and (FileInfo.Attr and faDirectory <> faDirectory) and (ExtractFileExt(FileInfo.Name) = '.' + acSkinExt) then begin
s := ExtractWord(1, FileInfo.Name, ['.']);
stl.Add(s);
if Result = '' then Result := s;
end;
end;
DosCode := FindNext(FileInfo);
end;
finally
FindClose(FileInfo);
end;
end;
stl.Sort;
sl.Assign(stl);
FreeAndNil(stl);
end;
procedure TsSkinManager.GetSkinSections(sl: TStrings);
var
i : integer;
begin
sl.Clear;
if SkinData.Active
then for i := Low(gd) to High(gd) do sl.Add(gd[i].ClassName);
end;
function TsSkinManager.GetSkinInfo: TacSkinInfo;
var
s : char;
begin
if SkinData.Active then begin
s := DecimalSeparator;
DecimalSeparator := '.';
Result := FloatToStr(SkinData.Version);
DecimalSeparator := s;
end
else Result := 'N/A';
end;
function TsSkinManager.GetVersion: string;
begin
Result := CurrentVersion;
end;
procedure TsSkinManager.InitConstantIndexes;
begin
with ConstData do begin
IndexGlobalInfo := GetSkinIndex(s_GlobalInfo);
if IndexGlobalInfo > -1 then begin
// Global data
CheckBoxChecked := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_CheckBoxChecked);
CheckBoxUnChecked := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_CheckBoxUnChecked);
CheckBoxGrayed := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_CheckBoxGrayed);
RadioButtonChecked := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_RadioButtonChecked);
RadioButtonUnChecked := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_RadioButtonUnChecked);
RadioButtonGrayed := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_RadioButtonGrayed);
SmallCheckBoxChecked := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_SmallBoxChecked);
SmallCheckBoxUnChecked := GetMaskIndex(IndexGlobalInfo, s_GlobalInfo, s_SmallBoxUnChecked);
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;
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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -