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

📄 seditorsmanager.pas

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

  Active := True;
  AssignSC(Application, Self);
  FreeAndNil(IniFile);
end;

procedure TsEditorsManager.SaveToFile(FileName: string);
const
  Section = 'Controls';
var
  IniFile : TMemIniFile;
begin
  IniFile := TMemIniFile.Create(FileName);
  // Painting
  WriteIniStr(Section, 'SelectionColor', IntToStr(Selection.Color), IniFile);
  WriteIniStr(Section, 'Color', IntToStr(Painting.Color), IniFile);
  WriteIniStr(Section, 'ColorBorderTop', IntToStr(Painting.ColorBorderTop), IniFile);
  WriteIniStr(Section, 'ColorBorderBottom', IntToStr(Painting.ColorBorderBottom), IniFile);
  WriteIniStr(Section, 'PaintingBevel', IntToStr(ord(Painting.Bevel)), IniFile);
  WriteIniStr(Section, 'PaintingBevelHot', IntToStr(ord(Selection.Border.Bevel)), IniFile);

  // Shadow
  WriteIniStr(Section, 'ShadowColor', IntToStr(Shadow.Color), IniFile);
  WriteIniStr(Section, 'ShadowOffset', IntToStr(Shadow.Offset), IniFile);
  WriteIniStr(Section, 'ShadowBlur', IntToStr(Shadow.Blur), IniFile);
  WriteIniStr(Section, 'ShadowTransparency', IntToStr(Shadow.Transparency), IniFile);
  WriteIniStr(Section, 'ShadowEnabled', iff(Shadow.Enabled, 'True', 'False'), IniFile);
  IniFile.UpdateFile;
  FreeAndNil(IniFile);
end;

procedure TsEditorsManager.SetSoftControls(const Value: boolean);
var
  M : TSMsetBoolean;
begin   
  if (FSoftControls <> Value) then begin
    FSoftControls := Value;
    if FActive then begin
      M.Value := Value;
      M.GroupIndex := GroupIndex;
      M.Msg := EM_SETSOFT;
      BroadCastS(FForm, TMessage(M));
    end;
  end;
end;

{ TsManagerPainting }

procedure TsManagerPainting.Assign(Source: TPersistent);
begin
  FColor := TsManagerPainting(Source).Color;
  FColorBorderTop := TsManagerPainting(Source).ColorBorderTop;
  FColorBorderBottom := TsManagerPainting(Source).ColorBorderBottom;
//  FParentColor := TsManagerPainting(Source).ParentColor;
  FBevel        := TsManagerPainting(Source).Bevel;
end;

constructor TsManagerPainting.Create(AOwner: TsEditorsManager);
begin
  inherited Create;
  FColorBorderTop := DefaultColorTopBorder;
  FColorBorderBottom := DefaultColorBottomBorder;
  FColor := DefaultColor;
  FBevel := ebAsBottomBorder;
  FOwner := AOwner;
end;

procedure TsManagerPainting.SetBevel(const Value: TsEditorBevel);
var
  M : TSMsetBevel;
begin
  if FOwner.FActive then begin
    M.Value := ord(Value);
    M.GroupIndex := FOwner.GroupIndex;
    M.Msg := EM_SETBEVEL;
    BroadCastS(FOwner.FForm, TMessage(M));
  end;
  FBevel := Value;
end;

procedure TsManagerPainting.SetColors(Index: Integer; Value: TColor);
var
  M : TSMSetColor;
begin
  if FOwner.FActive then begin
    M.Value := Value;
    M.GroupIndex := FOwner.GroupIndex;
    case index of
      0: M.Msg := EM_SETBORDERTOP;
      1: M.Msg := EM_SETBORDERBOTTOM;
      2: M.Msg := EM_SETCOLORHOT;
      3: M.Msg := EM_SETCOLOR;
    end;
    BroadCastS(FOwner.FForm, TMessage(M));
  end;
  case index of
    0: FColorBorderTop := Value;
    1: FColorBorderBottom := Value;
    2: FOwner.Selection.Color := Value;
    3: FColor := Value;
  end;
end;

{ TsManagerShadow }

procedure TsManagerShadow.Assign(Source: TPersistent);
begin
  FBlur         := TsManagerShadow(Source).Blur;
  FColor        := TsManagerShadow(Source).Color;
  FOffset       := TsManagerShadow(Source).Offset;
  FTransparency := TsManagerShadow(Source).Transparency;
  FEnabled      := TsManagerShadow(Source).Enabled;
end;

constructor TsManagerShadow.Create(AOwner: TsEditorsManager);
begin
  FOwner := AOwner;
  FColor := clBlack;
  FBlur := 4;
  FOffset := 8;
  FTransparency := 60;
  FEnabled := False;
end;

destructor TsManagerShadow.Destroy;
begin
  if Enabled then begin
    Enabled := False;
  end;
  inherited Destroy;
end;

procedure TsManagerShadow.SetBoolean(const Index: Integer; const Value: boolean);
var
  M : TSMsetBoolean;
begin
  if FOwner.FActive then begin
    M.Value := Value;
    M.GroupIndex := FOwner.GroupIndex;
    case Index of
      0: M.Msg := EM_SETSHADOWENABLED;
    end;
    BroadCastS(FOwner.FForm, TMessage(M));
    UpdateShadows(FOwner.FForm, FOwner.GroupIndex);
  end;
  case Index of
    0: begin
      FEnabled := Value;
    end;
  end;
end;

procedure TsManagerShadow.SetColors(Index: Integer; Value: TColor);
var
  M : TSMSetColor;
begin
  if FOwner.FActive then begin
    M.Value := Value;
    M.GroupIndex := FOwner.GroupIndex;
    case index of
      0: M.Msg := EM_SETCOLORSHADOW;
    end;
    BroadCastS(FOwner.FForm, M);
  end;
  case index of
    0: begin
      FColor := Value;
      UpdateShadows(FOwner.FForm, FOwner.GroupIndex);
    end;
  end;
end;

procedure TsManagerShadow.SetInteger(Index, Value: integer);
var
  M : TSMSetInteger;
begin
  if FOwner.FActive then begin
    M.Value := Value;
    M.GroupIndex := FOwner.GroupIndex;
    case Index of
      0: M.Msg := EM_SHADOWTRANSPARENCY;
      1: M.Msg := EM_SHADOWOFFSET;
      2: M.Msg := EM_SHADOWBLUR;
    end;
    BroadCastS(FOwner.FForm, M);
  end;
  Case Index of
    0: FTransparency := Value;
    1: FOffset := Value;
    2: FBlur := Value;
  end;
  UpdateShadows(FOwner.FForm, FOwner.GroupIndex);
end;

{ TsManagerSelection }

procedure TsManagerSelection.Assign(Source: TPersistent);
begin
  FColor := TsManagerSelection(Source).Color;
  Border.FBevel        := TsManagerSelection(Source).Border.Bevel;
end;

constructor TsManagerSelection.Create(AOwner: TsEditorsManager);
begin
  FOwner := AOwner;
  FMode := [msBorder, msColor];
  FBorder := TsManagerBorder.Create(Self);
  FColor := clWindow;
end;

destructor TsManagerSelection.destroy;
begin
  FreeAndNil(FBorder);
  inherited Destroy;
end;

procedure TsManagerSelection.SetColor(const Value: TColor);
var
  M : TSMsetColor;
begin
  if FColor <> Value then begin
    if FOwner.FActive then begin
      M.Value := Value;
      M.GroupIndex := FOwner.GroupIndex;
      M.Msg := EM_SETCOLORHOT;
      BroadCastS(FOwner.FForm, M);
    end;
    FColor := Value;
  end;
end;

procedure TsManagerSelection.SetMode(const Value: TModeSelection);
begin
  if (FMode <> Value) then begin
    FMode := Value;
  end;
end;                                  

{ TsManagerBorder }

constructor TsManagerBorder.Create(AOwner: TsManagerSelection);
begin
  FBevel := ebAsBottomBorder;
  FOwner := AOwner;
  FWidth := 2;
end;

procedure TsManagerBorder.SetBevel(const Value: TsEditorBevel);
var
  M : TSMsetBevel;
begin
  if FBevel <> Value then begin
    if FOwner.FOwner.FActive then begin
      M.Value := ord(Value);
      M.GroupIndex := FOwner.FOwner.GroupIndex;
      M.Msg := EM_SETBEVELHOT;
      BroadCastS(FOwner.FOwner.FForm, M);
    end;
    FBevel := Value;
  end;
end;

procedure TsManagerBorder.SetWidth(const Value: integer);
var
  M : TSMsetInteger;
begin
  if FWidth <> Value then begin
    if FOwner.FOwner.FActive then begin
      M.Value := Value;
      M.GroupIndex := FOwner.FOwner.GroupIndex;
      M.Msg := EM_SETBEVELWIDTHHOT;
      BroadCastS(FOwner.FOwner.FForm, M);
    end;
    FWidth := Value;
  end;
end;

end.

⌨️ 快捷键说明

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