⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smaskdata.pas

📁 AlphaControls是一个Delphi标准控件的集合
💻 PAS
📖 第 1 页 / 共 2 页
字号:

    finally
{$IFDEF USEDUMP}
      Dump.SaveToFile(sSkinData.SkinPath + '\loadedimages.txt');
      FreeAndNil(Dump);
{$ENDIF}
      if Assigned(Values) then FreeAndNil(Values);
      if Assigned(Sections) then FreeAndNil(Sections);
    end;

  end
  else begin
    FreeBitmaps;
    SkinIndex := -1;
    for i := 0 to sSkinData.SkinManager.InternalSkins.Count - 1 do begin
      if sSkinData.SkinManager.InternalSkins[i].Name = sSkinData.SkinManager.SkinName then begin
        SkinIndex := i;
        break;
      end;
    end;
    if SkinIndex < 0 then Exit;
    for i := 0 to sSkinData.SkinManager.InternalSkins[SkinIndex].Images.Count - 1 do begin
      l := Length(ma) + 1;
      SetLength(ma, l);
      ma[l - 1].Bmp := TBitmap.Create;
      ma[l - 1].Bmp.Assign(sSkinData.SkinManager.InternalSkins[SkinIndex].Images[i].Image);
      ma[l - 1].PropertyName := UpperCase(sSkinData.SkinManager.InternalSkins[SkinIndex].Images[i].PropertyName);
      ma[l - 1].ClassName := UpperCase(sSkinData.SkinManager.InternalSkins[SkinIndex].Images[i].SectionName);
      ma[l - 1].TransparentColor := clFuchsia;
    end;
  end;
end;

procedure LoadAllGeneralData;
var
  sf : TMemIniFile;
  Sections : TStringList;
  i, l, SkinIndex : integer;
  sg : TsSkinGenerals;

  function FindString(ClassName, PropertyName, DefaultValue : string) : string; var s : string; begin
    Result := sf.ReadString(ClassName, PropertyName, '?');
    if Result = '?' then begin
      s := sf.ReadString(ClassName, 'ParentClassName', '?');
      if (s <> '') and (s <> '?') and (s <> ClassName) then begin
        Result := FindString(s, PropertyName, '?');
      end;
    end;
    if Result = '?' then Result := DefaultValue;
  end;

  function FindInteger(ClassName, PropertyName : string; DefaultValue : integer) : integer; var s : string; begin
    Result := sf.ReadInteger(ClassName, PropertyName, -1);
     if Result = -1 then begin
      s := sf.ReadString(ClassName, 'ParentClassName', '?');
      if (s <> '') and (s <> '?') and (s <> ClassName) then begin
        Result := FindInteger(s, PropertyName, -1);
      end;
    end;
     if Result = -1 then Result := DefaultValue;
  end;
begin
  if sSkinData.SkinFile <> nil then begin // If external skin

    sf := sSkinData.SkinFile;
    Sections := TStringList.Create;
    try

    SetLength(gd, 0);
    sf.ReadSections(Sections);
    for i := 0 to Sections.Count - 1 do begin
      l := Length(gd) + 1;
      SetLength(gd, l);
//General data
      gd[i].ClassName := Sections[i];
//if gd[i].ClassName = 'FormTitle' then ;
      gd[i].ParentClassName := sf.ReadString(Sections[i], 'ParentClassName', '');

      gd[i].PaintingColor := FindInteger(Sections[i], 'PaintingColor', clWhite);
      gd[i].PaintingBevel := aControlBevels[FindInteger(Sections[i], 'PaintingBevel', 0)];
      gd[i].PaintingBevelWidth := FindInteger(Sections[i], 'PaintingBevelWidth', 2);
      gd[i].ShadowBlur := FindInteger(Sections[i], 'ShadowBlur', 6);
      gd[i].ShadowOffset := FindInteger(Sections[i], 'ShadowOffset', 3);
      gd[i].ShadowColor := sf.ReadInteger(Sections[i], 'ShadowColor', 0);
      gd[i].ShadowTransparency := FindInteger(Sections[i], 'ShadowTransparency', 60);
      gd[i].ShadowEnabled := UpperCase(FindString(Sections[i], 'ShadowEnabled', 'FALSE')) = 'TRUE';
      gd[i].ReservedBoolean := UpperCase(FindString(Sections[i], ReservedBoolean, 'FALSE')) = 'TRUE';

      gd[i].FontColor[1] := FindInteger(Sections[i], FColor, clBlack);
      gd[i].FontColor[2] := FindInteger(Sections[i], TCLeft  , -1);
      gd[i].FontColor[3] := FindInteger(Sections[i], TCTop   , -1);
      gd[i].FontColor[4] := FindInteger(Sections[i], TCRight , -1);
      gd[i].FontColor[5] := FindInteger(Sections[i], TCBottom, -1);

      gd[i].HotFontColor[1] := FindInteger(Sections[i], HotFColor, clBlack);
      gd[i].HotFontColor[2] := FindInteger(Sections[i], HotTCLeft  , -1);
      gd[i].HotFontColor[3] := FindInteger(Sections[i], HotTCTop   , -1);
      gd[i].HotFontColor[4] := FindInteger(Sections[i], HotTCRight , -1);
      gd[i].HotFontColor[5] := FindInteger(Sections[i], HotTCBottom, -1);

//Panels data
      gd[i].PaintingTransparency := FindInteger(Sections[i], 'PaintingTransparency', 0);
      gd[i].GradientPercent := FindInteger(Sections[i], 'GradientPercent', 0);
      gd[i].ImagePercent := FindInteger(Sections[i], 'ImagePercent', 0);
      gd[i].GradientData := FindString(Sections[i], 'GradientData', ' ');
      if gd[i].GradientData <> ' ' then PrepareGradArray(gd[i].GradientData, gd[i].GradientArray);
// Buttons data
      gd[i].ShowFocus := UpperCase(FindString(Sections[i], 'ShowFocus', 'FALSE')) = 'TRUE';
// ---- BtnEffects ----
      gd[i].FadingEnabled := UpperCase(FindString(Sections[i], 'FadingEnabled', 'FALSE')) = 'TRUE';
      gd[i].FadingIntervalIn := FindInteger(Sections[i], 'FadingIntervalIn', 5);
      gd[i].FadingIntervalOut := FindInteger(Sections[i], 'FadingIntervalOut', 5);
      gd[i].FadingIterations := FindInteger(Sections[i], 'FadingIterations', 5);

// ---- PaintingOptions -----
      gd[i].HotPaintingColor := TColor(FindInteger(Sections[i], 'HotPaintingColor', clWhite));
      gd[i].HotPaintingTransparency := FindInteger(Sections[i], 'HotPaintingTransparency', 0);
      gd[i].HotPaintingBevel := aControlBevels[FindInteger(Sections[i], 'HotPaintingBevel', 0)];
      gd[i].HotPaintingBevelWidth := FindInteger(Sections[i], 'HotPaintingBevelWidth', 2);
      gd[i].HotGradientPercent := FindInteger(Sections[i], 'HotGradientPercent', 0);
      gd[i].HotGradientData := FindString(Sections[i], 'HotGradientData', '');
      if gd[i].HotGradientData <> ' ' then PrepareGradArray(gd[i].HotGradientData, gd[i].HotGradientArray);
      gd[i].HotImagePercent := FindInteger(Sections[i], 'HotImagePercent', 0);
// Editors data
      gd[i].PaintingColorBorderTop := TColor(FindInteger(Sections[i], 'PaintingColorBorderTop', 0));
      gd[i].PaintingColorBorderBottom := TColor(FindInteger(Sections[i], 'PaintingColorBorderBottom', 0));
      gd[i].SelectionColor := TColor(FindInteger(Sections[i], 'SelectionColor', clWhite));
      gd[i].SelectionBorderBevel := aEditorBevels[FindInteger(Sections[i], 'SelectionBorderBevel', 2)];
      gd[i].SelectionBorderWidth := FindInteger(Sections[i], 'SelectionBorderWidth', 2);
    end;

    finally
      if Assigned(Sections) then FreeAndNil(Sections);
    end;
  end
  else begin
    SkinIndex := -1;
    for i := 0 to sSkinData.SkinManager.InternalSkins.Count - 1 do begin
      if sSkinData.SkinManager.InternalSkins[i].Name = sSkinData.SkinManager.SkinName then begin
        SkinIndex := i;
        break;
      end;
    end;
    if SkinIndex = -1 then Exit;

    SetLength(gd, 0);

    sg := sSkinData.SkinManager.InternalSkins[SkinIndex].GeneralData;
    for i := 0  to sg.Count - 1 do begin
      l := Length(gd) + 1;
      SetLength(gd, l);
      try

//General data
      gd[i].ClassName                   := sg[i].SectionName;

      gd[i].ParentClassName             := sg[i].ParentClassName;

      gd[i].PaintingColor               := sg[i].PaintingColor;
      gd[i].PaintingBevel               := sg[i].PaintingBevel;
      gd[i].PaintingBevelWidth          := sg[i].PaintingBevelWidth;
      gd[i].ShadowBlur                  := sg[i].ShadowBlur;
      gd[i].ShadowOffset                := sg[i].ShadowOffset;
      gd[i].ShadowColor                 := sg[i].ShadowColor;
      gd[i].ShadowTransparency          := sg[i].ShadowTransparency;
      gd[i].ShadowEnabled               := sg[i].ShadowEnabled;
      gd[i].ReservedBoolean             := sg[i].ReservedBoolean;

//Panels data
      gd[i].PaintingTransparency        := sg[i].PaintingTransparency;
      gd[i].GradientPercent             := sg[i].GradientPercent;
      gd[i].ImagePercent                := sg[i].ImagePercent;
      gd[i].GradientData                := sg[i].GradientData;
                PrepareGradArray(sg[i].GradientData, gd[i].GradientArray);
// Buttons data
      gd[i].ShowFocus                   := sg[i].ShowFocus;
// ---- BtnEffects ----
      gd[i].FadingEnabled               := sg[i].FadingEnabled;
      gd[i].FadingIntervalIn            := sg[i].FadingIntervalIn;
      gd[i].FadingIntervalOut           := sg[i].FadingIntervalOut;
      gd[i].FadingIterations            := sg[i].FadingIterations;

// ---- PaintingOptions -----
      gd[i].HotPaintingColor            := sg[i].HotPaintingColor;
      gd[i].HotPaintingTransparency     := sg[i].HotPaintingTransparency;
      gd[i].HotPaintingBevel            := sg[i].HotPaintingBevel;
      gd[i].HotPaintingBevelWidth       := sg[i].HotPaintingBevelWidth;
      gd[i].HotGradientPercent          := sg[i].HotGradientPercent;
      gd[i].HotGradientData             := sg[i].HotGradientData;
        PrepareGradArray(sg[i].HotGradientData, gd[i].HotGradientArray);
      gd[i].HotImagePercent             := sg[i].HotImagePercent;

//if gd[i].ClassName = 'MenuItem' then alert;
      if sg[i].HotFontColor <> '' then begin
        gd[i].HotFontColor[1]             := StrToInt(ExtractWord(1, sg[i].HotFontColor, [' ']));
        gd[i].HotFontColor[2]             := StrToInt(ExtractWord(2, sg[i].HotFontColor, [' ']));
        gd[i].HotFontColor[3]             := StrToInt(ExtractWord(3, sg[i].HotFontColor, [' ']));
        gd[i].HotFontColor[4]             := StrToInt(ExtractWord(4, sg[i].HotFontColor, [' ']));
        gd[i].HotFontColor[5]             := StrToInt(ExtractWord(5, sg[i].HotFontColor, [' ']));
      end
      else begin
        gd[i].HotFontColor[1]             := 0;
        gd[i].HotFontColor[2]             := -1;
        gd[i].HotFontColor[3]             := -1;
        gd[i].HotFontColor[4]             := -1;
        gd[i].HotFontColor[5]             := -1;
      end;
      if sg[i].FontColor <> '' then begin
        gd[i].FontColor[1]                := StrToInt(ExtractWord(1, sg[i].FontColor, [' ']));
        gd[i].FontColor[2]                := StrToInt(ExtractWord(2, sg[i].FontColor, [' ']));
        gd[i].FontColor[3]                := StrToInt(ExtractWord(3, sg[i].FontColor, [' ']));
        gd[i].FontColor[4]                := StrToInt(ExtractWord(4, sg[i].FontColor, [' ']));
        gd[i].FontColor[5]                := StrToInt(ExtractWord(5, sg[i].FontColor, [' ']));
      end
      else begin
        gd[i].FontColor[1]             := 0;
        gd[i].FontColor[2]             := -1;
        gd[i].FontColor[3]             := -1;
        gd[i].FontColor[4]             := -1;
        gd[i].FontColor[5]             := -1;
      end;

// Editors data
      gd[i].PaintingColorBorderTop      := sg[i].PaintingColorBorderTop;
      gd[i].PaintingColorBorderBottom   := sg[i].PaintingColorBorderBottom;
      gd[i].SelectionColor              := sg[i].SelectionColor;
      gd[i].SelectionBorderBevel        := sg[i].SelectionBorderBevel;
      gd[i].SelectionBorderWidth        := sg[i].SelectionBorderWidth;
      except
      end;
    end;
  end;
end;

function IsValidImgIndex(ImageIndex : integer) : boolean;
begin
  Result := sSkinData.Active and (ImageIndex > -1) and (ImageIndex < Length(ma));
end;

function IsValidSkinIndex(SkinIndex : integer) : boolean;
begin
  Result := sSkinData.Active and (SkinIndex > -1) and (SkinIndex < Length(gd));
end;

initialization

finalization
  FreeBitmaps;
  FreeJpegs;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -