home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / Essentials / SETUP.EXE / %MAINDIR% / EsLabel0.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-11-28  |  19.4 KB  |  579 lines

  1. {*********************************************************}
  2. {*                  ESLABEL0.PAS 1.05                    *}
  3. {*      Copyright (c) 1997-98 TurboPower Software Co     *}
  4. {*                 All rights reserved.                  *}
  5. {*********************************************************}
  6.  
  7. {$I ES.INC}
  8.  
  9. {$B-} {Complete Boolean Evaluation}
  10. {$I+} {Input/Output-Checking}
  11. {$P+} {Open Parameters}
  12. {$T-} {Typed @ Operator}
  13. {$W-} {Windows Stack Frame}
  14. {$X+} {Extended Syntax}
  15.  
  16. {$IFNDEF Win32}
  17.   {$G+} {286 Instructions}
  18.   {$N+} {Numeric Coprocessor}
  19.   {$C MOVEABLE,DEMANDLOAD,DISCARDABLE}
  20. {$ENDIF}
  21.  
  22. unit EsLabel0;
  23.  
  24. interface
  25.  
  26. uses
  27.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  28.   Forms, Dialogs, StdCtrls, EsLabel, ExtCtrls, DsgnIntf, Menus, IniFiles,
  29.   EsBase, EsData, EsMnuBtn, EsClrCbx, EsDir, EsWebPE, TypInfo;
  30.  
  31. type
  32.   TEsLabelFrm = class(TForm)
  33.     Panel1: TPanel;
  34.     EsLabel: TEsLabel;
  35.     Button1: TButton;
  36.     Button2: TButton;
  37.     Panel2: TPanel;
  38.     SchemeCb: TComboBox;
  39.     SaveAsBtn: TButton;
  40.     DeleteBtn: TButton;
  41.     Panel3: TPanel;
  42.     GraduateRg: TRadioGroup;
  43.     ShadowRg: TRadioGroup;
  44.     HighlightRg: TRadioGroup;
  45.     FromColorCcb: TEsColorComboBox;
  46.     HighlightColorCcb: TEsColorComboBox;
  47.     ShadowColorCcb: TEsColorComboBox;
  48.     HighlightDirectionLbl: TLabel;
  49.     ShadowDirectionLbl: TLabel;
  50.     FontColorCcb: TEsColorComboBox;
  51.     Panel4: TPanel;
  52.     FontSizeSb: TScrollBar;
  53.     FontSizeLbl: TLabel;
  54.     HighlightDepthLbl: TLabel;
  55.     ShadowDepthLbl: TLabel;
  56.     ShadowDepthSb: TScrollBar;
  57.     HighlightDepthSb: TScrollBar;
  58.     AppearanceCb: TComboBox;
  59.     ColorSchemeCb: TComboBox;
  60.     procedure FontSizeSbChange(Sender: TObject);
  61.     procedure HighlightDepthSbChange(Sender: TObject);
  62.     procedure ShadowDepthSbChange(Sender: TObject);
  63.     procedure GraduateRgClick(Sender: TObject);
  64.     procedure HighlightRgClick(Sender: TObject);
  65.     procedure ShadowRgClick(Sender: TObject);
  66.     procedure FromColorCcbChange(Sender: TObject);
  67.     procedure HighlightColorCcbChange(Sender: TObject);
  68.     procedure ShadowColorCcbChange(Sender: TObject);
  69.     procedure FontColorCcbChange(Sender: TObject);
  70.     procedure FormCreate(Sender: TObject);
  71.     procedure SaveAsBtnClick(Sender: TObject);
  72.     procedure DeleteBtnClick(Sender: TObject);
  73.     procedure SchemeCbChange(Sender: TObject);
  74.     procedure AppearanceCbChange(Sender: TObject);
  75.     procedure ColorSchemeCbChange(Sender: TObject);
  76.   private
  77.   public
  78.     HighlightDirectionDp : TEsDirectionPicker;
  79.     ShadowDirectionDp : TEsDirectionPicker;
  80.     SettingScheme : Boolean;
  81.     SettingCb : Boolean;
  82.  
  83.     procedure DeleteScheme(const S : string);
  84.     procedure HighlightDirectionChange(Sender: TObject);
  85.     procedure ShadowDirectionChange(Sender: TObject);
  86.     procedure SchemeChange;
  87.   end;
  88.  
  89. type
  90.   {component editor for the notebook pages}
  91.   TEsLabelEditor = class(TDefaultEditor)
  92.   public
  93.     procedure ExecuteVerb(Index : Integer);
  94.       override;
  95.     function GetVerb(Index : Integer) : AnsiString;
  96.       override;
  97.     function GetVerbCount : Integer;
  98.       override;
  99.   end;
  100.  
  101.   {property editor for the special settings class}
  102.   TEsCustomSettingsProperty = class(TClassProperty)
  103.   public
  104.     procedure Edit;
  105.       override;
  106.     function GetAttributes : TPropertyAttributes;
  107.       override;
  108.   end;
  109.  
  110. function EditEsLabel(L : TEsLabel) : Boolean;
  111.  
  112.  
  113. implementation
  114.  
  115. uses EsLabel1;
  116.  
  117. {$R *.DFM}
  118.  
  119. const
  120.   IniFileName = 'ESSENCE.INI';
  121.  
  122. function EditEsLabel(L : TEsLabel) : Boolean;
  123. var
  124.   D : TEsLabelFrm;
  125. begin
  126.   Result := False;
  127.   D := TEsLabelFrm.Create(Application);
  128.   try
  129.     D.EsLabel.Font.Assign(L.Font);
  130.     D.EsLabel.CustomSettings.Assign(L.CustomSettings);
  131.  
  132.     D.FontSizeSb.Position := L.Font.Size;
  133.     D.HighlightDepthSB.Position := L.CustomSettings.HighlightDepth;
  134.     D.ShadowDepthSB.Position := L.CustomSettings.ShadowDepth;
  135.  
  136.     D.GraduateRg.ItemIndex := Ord(L.CustomSettings.GraduateStyle);
  137.     D.HighlightRg.ItemIndex := Ord(L.CustomSettings.HighlightStyle);
  138.     D.ShadowRg.ItemIndex := Ord(L.CustomSettings.ShadowStyle);
  139.  
  140.     D.FontColorCcb.SelectedColor := L.Font.Color;
  141.     D.FromColorCcb.SelectedColor := L.CustomSettings.GraduateFromColor;
  142.     D.HighlightColorCcb.SelectedColor := L.CustomSettings.HighlightColor;
  143.     D.ShadowColorCcb.SelectedColor := L.CustomSettings.ShadowColor;
  144.  
  145.     D.HighlightDirectionDp.Direction := Ord(L.CustomSettings.HighlightDirection)-1;
  146.     D.ShadowDirectionDp.Direction := Ord(L.CustomSettings.ShadowDirection)-1;
  147.  
  148.     if D.ShowModal = mrOK then begin
  149.       L.CustomSettings.BeginUpdate;
  150.       try
  151.         L.Font.Assign(D.EsLabel.Font);
  152.         L.CustomSettings.Assign(D.EsLabel.CustomSettings);
  153.       finally
  154.         L.CustomSettings.EndUpdate;
  155.       end;
  156.       Result := True;
  157.     end;
  158.   finally
  159.     D.Free;
  160.   end;
  161. end;
  162.  
  163.  
  164. {*** TEsLabelEditor ***}
  165.  
  166. procedure TEsLabelEditor.ExecuteVerb(Index : Integer);
  167. begin
  168.   case Index of
  169.     0 : if EditEsLabel(TEsLabel(Component)) then
  170.           Designer.Modified;
  171.     1 : ;
  172.     2 : ShellWebCall1;
  173.     3 : ShellWebCall2;
  174.     4 : ShellMailCall;
  175.   end;
  176. end;
  177.  
  178. function TEsLabelEditor.GetVerb(Index : Integer) : AnsiString;
  179. begin
  180.   case Index of
  181.     0 : Result := 'Style Manager';
  182.     1 : Result := '-';
  183.     2 : Result := WebText1;
  184.     3 : Result := WebText2;
  185.     4 : Result := MailText;
  186.   end;
  187. end;
  188.  
  189. function TEsLabelEditor.GetVerbCount : Integer;
  190. begin
  191.   Result := 5;
  192. end;
  193.  
  194.  
  195. {*** TEsCustomSettingsProperty ***}
  196.  
  197. procedure TEsCustomSettingsProperty.Edit;
  198. var
  199.   I : Integer;
  200.   C : TComponent;
  201.   L : TEsLabel;
  202.   M : TEsLabel;
  203. begin
  204.   C := TComponent(GetComponent(0));
  205.   if C is TEsCustomLabel then begin
  206.     L := TEsLabel(C);
  207.     if EditEsLabel(L) then begin
  208.       {if more than one component selected, apply changes to others}
  209.       for I := 2 to PropCount do begin
  210.         M := TEsLabel(GetComponent(Pred(I)));
  211.         M.CustomSettings.BeginUpdate;
  212.         try
  213.           M.Font.Assign(L.Font);
  214.           M.CustomSettings.Assign(L.CustomSettings);
  215.         finally
  216.           M.CustomSettings.EndUpdate;
  217.         end;
  218.         M.Invalidate;
  219.       end;
  220.       Designer.Modified;
  221.     end;
  222.   end;
  223. end;
  224.  
  225. function TEsCustomSettingsProperty.GetAttributes: TPropertyAttributes;
  226. begin
  227.   Result := [paSubProperties, paMultiSelect, paDialog, paReadOnly]
  228. end;
  229.  
  230.  
  231. {*** TEsLabelFrm ***}
  232.  
  233. procedure TEsLabelFrm.FontSizeSbChange(Sender: TObject);
  234. begin
  235.   EsLabel.Font.Size := FontSizeSb.Position;
  236.   FontSizeLbl.Caption := IntToStr(EsLabel.Font.Size);
  237.   SchemeChange;
  238. end;
  239.  
  240. procedure TEsLabelFrm.HighlightDepthSbChange(Sender: TObject);
  241. begin
  242.   EsLabel.CustomSettings.HighlightDepth := HighlightDepthSb.Position;
  243.   HighlightDepthLbl.Caption := IntToStr(EsLabel.CustomSettings.HighlightDepth);
  244.   SchemeChange;
  245. end;
  246.  
  247. procedure TEsLabelFrm.ShadowDepthSbChange(Sender: TObject);
  248. begin
  249.   EsLabel.CustomSettings.ShadowDepth := ShadowDepthSb.Position;
  250.   ShadowDepthLbl.Caption := IntToStr(EsLabel.CustomSettings.ShadowDepth);
  251.   SchemeChange;
  252. end;
  253.  
  254. procedure TEsLabelFrm.GraduateRgClick(Sender: TObject);
  255. begin
  256.   case GraduateRg.ItemIndex of
  257.     0 : EsLabel.CustomSettings.GraduateStyle := gsNone;
  258.     1 : EsLabel.CustomSettings.GraduateStyle := gsHorizontal;
  259.     2 : EsLabel.CustomSettings.GraduateStyle := gsVertical;
  260.   end;
  261.   SchemeChange;
  262. end;
  263.  
  264. procedure TEsLabelFrm.HighlightRgClick(Sender: TObject);
  265. begin
  266.   case HighlightRg.ItemIndex of
  267.     0 : EsLabel.CustomSettings.HighlightStyle := ssPlain;
  268.     1 : EsLabel.CustomSettings.HighlightStyle := ssExtrude;
  269.     2 : EsLabel.CustomSettings.HighlightStyle := ssGraduated;
  270.   end;
  271.   SchemeChange;
  272. end;
  273.  
  274. procedure TEsLabelFrm.ShadowRgClick(Sender: TObject);
  275. begin
  276.   case ShadowRg.ItemIndex of
  277.     0 : EsLabel.CustomSettings.ShadowStyle := ssPlain;
  278.     1 : EsLabel.CustomSettings.ShadowStyle := ssExtrude;
  279.     2 : EsLabel.CustomSettings.ShadowStyle := ssGraduated;
  280.   end;
  281.   SchemeChange;
  282. end;
  283.  
  284. procedure TEsLabelFrm.FromColorCcbChange(Sender: TObject);
  285. begin
  286.   EsLabel.CustomSettings.GraduateFromColor := FromColorCcb.SelectedColor;
  287.   SchemeChange;
  288. end;
  289.  
  290. procedure TEsLabelFrm.HighlightColorCcbChange(Sender: TObject);
  291. begin
  292.   EsLabel.CustomSettings.HighlightColor := HighlightColorCcb.SelectedColor;
  293.   SchemeChange;
  294. end;
  295.  
  296. procedure TEsLabelFrm.ShadowColorCcbChange(Sender: TObject);
  297. begin
  298.   EsLabel.CustomSettings.ShadowColor := ShadowColorCcb.SelectedColor;
  299.   SchemeChange;
  300. end;
  301.  
  302. procedure TEsLabelFrm.FontColorCcbChange(Sender: TObject);
  303. begin
  304.   EsLabel.Font.Color := FontColorCcb.SelectedColor;
  305.   SchemeChange;
  306. end;
  307.  
  308. procedure TEsLabelFrm.FormCreate(Sender: TObject);
  309. var
  310.   Ini : TIniFile;
  311.   A   : TEsAppearance;
  312.   C   : TEsColorScheme;
  313. begin
  314.   Top := (Screen.Height - Height) div 3;
  315.   Left := (Screen.Width - Width) div 2;
  316.  
  317.   {load scheme names into combo box}
  318.   Ini := TIniFile.Create('ESSENCE.INI');
  319.   try
  320.     SchemeCb.Items.Clear;
  321.     Ini.ReadSection('Schemes', SchemeCb.Items);
  322.   finally
  323.     Ini.Free;
  324.   end;
  325.  
  326.   {create direction pickers}
  327.   HighlightDirectionDp := TEsDirectionPicker.Create(Self);
  328.   HighlightDirectionDp.Top := HighlightDirectionLbl.Top;
  329.   HighlightDirectionDp.Left := HighlightDirectionLbl.Left + HighlightDirectionLbl.Width;
  330.   HighlightDirectionDp.Width := 50;
  331.   HighlightDirectionDp.Height := 50;
  332.   HighlightDirectionDp.NumDirections := 8;
  333.   HighlightDirectionDp.OnChange := HighlightDirectionChange;
  334.   HighlightDirectionDp.Parent := HighlightDirectionLbl.Parent;
  335.  
  336.   ShadowDirectionDp := TEsDirectionPicker.Create(Self);
  337.   ShadowDirectionDp.Top := ShadowDirectionLbl.Top;
  338.   ShadowDirectionDp.Left := ShadowDirectionLbl.Left + ShadowDirectionLbl.Width;
  339.   ShadowDirectionDp.Width := 50;
  340.   ShadowDirectionDp.Height := 50;
  341.   ShadowDirectionDp.NumDirections := 8;
  342.   ShadowDirectionDp.OnChange := ShadowDirectionChange;
  343.   ShadowDirectionDp.Parent := ShadowDirectionLbl.Parent;
  344.  
  345.   {initialize appearance and color scheme comboboxes using rtti}
  346.   {$IFDEF WIN32}
  347.   for A := Low(TEsAppearance) to High(TEsAppearance) do
  348.     AppearanceCb.Items.Add(GetEnumName(TypeInfo(TEsAppearance), Ord(A)));
  349.   for C := Low(TEsColorScheme) to High(TEsColorScheme) do
  350.     ColorSchemeCb.Items.Add(GetEnumName(TypeInfo(TEsColorScheme), Ord(C)));
  351.   {$ELSE}
  352.   for A := Low(TEsAppearance) to High(TEsAppearance) do
  353.     AppearanceCb.Items.Add(GetEnumName(TypeInfo(TEsAppearance), Ord(A))^);
  354.   for C := Low(TEsColorScheme) to High(TEsColorScheme) do
  355.     ColorSchemeCb.Items.Add(GetEnumName(TypeInfo(TEsColorScheme), Ord(C))^);
  356.   {$ENDIF WIN32}
  357. end;
  358.  
  359. procedure TEsLabelFrm.SaveAsBtnClick(Sender: TObject);
  360. var
  361.   Ini : TIniFile;
  362.   S   : string;
  363. begin
  364.   with TSaveSchemeFrm.Create(Self) do begin
  365.     if (ShowModal = mrOK) and (SchemeNameEd.Text > '') then begin
  366.       S := SchemeNameEd.Text;
  367.       Ini := TIniFile.Create('ESSENCE.INI');
  368.       try
  369.         {delete scheme}
  370.         DeleteScheme(S);
  371.  
  372.         {add scheme name to list of schemes}
  373.         Ini.WriteInteger('Schemes', S, 0);
  374.  
  375.         {create new scheme section and add values}
  376.         Ini.WriteInteger(S, 'GraduateStyle', Ord(EsLabel.CustomSettings.GraduateStyle));
  377.         Ini.WriteInteger(S, 'HighlightStyle', Ord(EsLabel.CustomSettings.HighlightStyle));
  378.         Ini.WriteInteger(S, 'ShadowStyle', Ord(EsLabel.CustomSettings.ShadowStyle));
  379.         Ini.WriteString(S, 'GraduateFromColor', ColorToString(EsLabel.CustomSettings.GraduateFromColor));
  380.         Ini.WriteString(S, 'HighlightColor', ColorToString(EsLabel.CustomSettings.HighlightColor));
  381.         Ini.WriteString(S, 'ShadowColor', ColorToString(EsLabel.CustomSettings.ShadowColor));
  382.         Ini.WriteInteger(S, 'HighlightDirection', Ord(EsLabel.CustomSettings.HighlightDirection));
  383.         Ini.WriteInteger(S, 'ShadowDirection', Ord(EsLabel.CustomSettings.ShadowDirection));
  384.         Ini.WriteString(S, 'FontColor', ColorToString(EsLabel.Font.Color));
  385.         Ini.WriteString(S, 'FontName', EsLabel.Font.Name);
  386.         Ini.WriteInteger(S, 'FontPitch', Ord(EsLabel.Font.Pitch));
  387.         Ini.WriteInteger(S, 'FontSize', EsLabel.Font.Size);
  388.         Ini.WriteBool(S, 'FontBold', fsBold in EsLabel.Font.Style);
  389.         Ini.WriteBool(S, 'FontItalic', fsItalic in EsLabel.Font.Style);
  390.         Ini.WriteBool(S, 'FontUnderline', fsUnderline in EsLabel.Font.Style);
  391.         Ini.WriteBool(S, 'FontStrikeOut', fsStrikeOut in EsLabel.Font.Style);
  392.         Ini.WriteInteger(S, 'HighlightDepth', EsLabel.CustomSettings.HighlightDepth);
  393.         Ini.WriteInteger(S, 'ShadowDepth', EsLabel.CustomSettings.ShadowDepth);
  394.       finally
  395.         Ini.Free;
  396.       end;
  397.  
  398.       {add item to the combobox, if its not there already}
  399.       if SchemeCb.Items.IndexOf(S) < 0 then
  400.         SchemeCb.Items.Add(S);
  401.     end;
  402.     Free;
  403.   end;
  404. end;
  405.  
  406. procedure TEsLabelFrm.DeleteBtnClick(Sender: TObject);
  407. var
  408.   I   : Integer;
  409. begin
  410.   I := SchemeCb.ItemIndex;
  411.   if I > -1 then begin
  412.     DeleteScheme(SchemeCb.Items[I]);
  413.     {delete the entry from the combo box}
  414.     SchemeCb.Items.Delete(I);
  415.   end;
  416. end;
  417.  
  418. procedure TEsLabelFrm.DeleteScheme(const S : string);
  419. var
  420.   Ini : TIniFile;
  421.   {$IFNDEF Win32}
  422.   Buf : array[0..255] of Char;
  423.   {$ENDIF}
  424. begin
  425.   {delete the scheme entry from the ini file}
  426.   Ini := TIniFile.Create(IniFileName);
  427.   try
  428.     {delete the section}
  429.     Ini.EraseSection(S);
  430.     {delete the scheme name}
  431.     {$IFDEF Win32}
  432.     Ini.DeleteKey('Schemes', S);
  433.     {$ELSE}
  434.     StrPLCopy(Buf, S, SizeOf(Buf)-1);
  435.     WritePrivateProfileString('Schemes', Buf, nil, IniFileName);
  436.     {$ENDIF}
  437.   finally
  438.     Ini.Free;
  439.   end;
  440. end;
  441.  
  442. procedure TEsLabelFrm.SchemeCbChange(Sender: TObject);
  443. var
  444.   I   : Integer;
  445.   Ini : TIniFile;
  446.   S   : string;
  447. begin
  448.   I := SchemeCb.ItemIndex;
  449.   if I > -1 then begin
  450.     S := SchemeCb.Items[I];
  451.     Ini := TIniFile.Create('ESSENCE.INI');
  452.     SettingScheme := True;
  453.     try
  454.       EsLabel.CustomSettings.GraduateStyle := TEsGraduateStyle(Ini.ReadInteger(S, 'GraduateStyle', 0));
  455.       EsLabel.CustomSettings.HighlightStyle := TEsShadeStyle(Ini.ReadInteger(S, 'HighlightStyle', 0));
  456.       EsLabel.CustomSettings.ShadowStyle := TEsShadeStyle(Ini.ReadInteger(S, 'ShadowStyle', 0));
  457.       EsLabel.CustomSettings.GraduateFromColor := StringToColor(Ini.ReadString(S, 'GraduateFromColor', '0'));
  458.       EsLabel.CustomSettings.HighlightColor := StringToColor(Ini.ReadString(S, 'HighlightColor', '0'));
  459.       EsLabel.CustomSettings.ShadowColor := StringToColor(Ini.ReadString(S, 'ShadowColor', '0'));
  460.       EsLabel.CustomSettings.HighlightDirection := TEsShadeDirection(Ini.ReadInteger(S, 'HighlightDirection', 0));
  461.       EsLabel.CustomSettings.ShadowDirection := TEsShadeDirection(Ini.ReadInteger(S, 'ShadowDirection', 0));
  462.       EsLabel.CustomSettings.HighlightDepth := Ini.ReadInteger(S, 'HighlightDepth', 1);
  463.       EsLabel.CustomSettings.ShadowDepth := Ini.ReadInteger(S, 'ShadowDepth', 1);
  464.  
  465.       EsLabel.Font.Color := StringToColor(Ini.ReadString(S, 'FontColor', '0'));
  466.       EsLabel.Font.Name := Ini.ReadString(S, 'FontName', 'Times New Roman');
  467.       EsLabel.Font.Pitch := TFontPitch(Ini.ReadInteger(S, 'FontPitch', 0));
  468.       EsLabel.Font.Size := Ini.ReadInteger(S, 'FontSize', 10);
  469.       EsLabel.Font.Style := [];
  470.       if Ini.ReadBool(S, 'FontBold', False) then
  471.         EsLabel.Font.Style := EsLabel.Font.Style + [fsBold];
  472.       if Ini.ReadBool(S, 'FontItalic', False) then
  473.         EsLabel.Font.Style := EsLabel.Font.Style + [fsItalic];
  474.       if Ini.ReadBool(S, 'FontUnderline', False) then
  475.         EsLabel.Font.Style := EsLabel.Font.Style + [fsUnderline];
  476.       if Ini.ReadBool(S, 'FontStrikeOut', False) then
  477.         EsLabel.Font.Style := EsLabel.Font.Style + [fsStrikeOut];
  478.  
  479.       FontSizeSb.Position := EsLabel.Font.Size;
  480.       HighlightDepthSB.Position := EsLabel.CustomSettings.HighlightDepth;
  481.       ShadowDepthSB.Position := EsLabel.CustomSettings.ShadowDepth;
  482.       GraduateRg.ItemIndex := Ord(EsLabel.CustomSettings.GraduateStyle);
  483.       HighlightRg.ItemIndex := Ord(EsLabel.CustomSettings.HighlightStyle);
  484.       ShadowRg.ItemIndex := Ord(EsLabel.CustomSettings.ShadowStyle);
  485.       FontColorCcb.SelectedColor := EsLabel.Font.Color;
  486.       FromColorCcb.SelectedColor := EsLabel.CustomSettings.GraduateFromColor;
  487.       HighlightColorCcb.SelectedColor := EsLabel.CustomSettings.HighlightColor;
  488.       ShadowColorCcb.SelectedColor := EsLabel.CustomSettings.ShadowColor;
  489.       HighlightDirectionDp.Direction := Ord(EsLabel.CustomSettings.HighlightDirection)-1;
  490.       ShadowDirectionDp.Direction := Ord(EsLabel.CustomSettings.ShadowDirection)-1;
  491.     finally
  492.       SettingScheme := False;
  493.       Ini.Free;
  494.     end;
  495.   end;
  496. end;
  497.  
  498. procedure TEsLabelFrm.HighlightDirectionChange(Sender: TObject);
  499. begin
  500.   EsLabel.CustomSettings.HighlightDirection :=
  501.     TEsShadeDirection(HighlightDirectionDp.Direction+1);
  502.   SchemeChange;
  503. end;
  504.  
  505. procedure TEsLabelFrm.ShadowDirectionChange(Sender: TObject);
  506. begin
  507.   EsLabel.CustomSettings.ShadowDirection :=
  508.     TEsShadeDirection(ShadowDirectionDp.Direction+1);
  509.   SchemeChange;
  510. end;
  511.  
  512. procedure TEsLabelFrm.SchemeChange;
  513. begin
  514.   if not SettingScheme then
  515.     SchemeCb.ItemIndex := -1;
  516.  
  517.   if not SettingCb then begin
  518.     AppearanceCb.ItemIndex := -1;
  519.     ColorSchemeCb.ItemIndex := -1;
  520.   end;
  521. end;
  522.  
  523.  
  524. procedure TEsLabelFrm.AppearanceCbChange(Sender: TObject);
  525. begin
  526.   if AppearanceCb.ItemIndex > -1 then begin
  527.     SettingScheme := True;
  528.     SettingCb := True;
  529.     try
  530.       EsLabel.Appearance := TEsAppearance(AppearanceCb.ItemIndex);
  531.  
  532.       FontSizeSb.Position := EsLabel.Font.Size;
  533.       HighlightDepthSB.Position := EsLabel.CustomSettings.HighlightDepth;
  534.       ShadowDepthSB.Position := EsLabel.CustomSettings.ShadowDepth;
  535.       GraduateRg.ItemIndex := Ord(EsLabel.CustomSettings.GraduateStyle);
  536.       HighlightRg.ItemIndex := Ord(EsLabel.CustomSettings.HighlightStyle);
  537.       ShadowRg.ItemIndex := Ord(EsLabel.CustomSettings.ShadowStyle);
  538.       FontColorCcb.SelectedColor := EsLabel.Font.Color;
  539.       FromColorCcb.SelectedColor := EsLabel.CustomSettings.GraduateFromColor;
  540.       HighlightColorCcb.SelectedColor := EsLabel.CustomSettings.HighlightColor;
  541.       ShadowColorCcb.SelectedColor := EsLabel.CustomSettings.ShadowColor;
  542.       HighlightDirectionDp.Direction := Ord(EsLabel.CustomSettings.HighlightDirection)-1;
  543.       ShadowDirectionDp.Direction := Ord(EsLabel.CustomSettings.ShadowDirection)-1;
  544.     finally
  545.       SettingCb := False;
  546.       SettingScheme := False;
  547.     end;
  548.   end;
  549. end;
  550.  
  551. procedure TEsLabelFrm.ColorSchemeCbChange(Sender: TObject);
  552. begin
  553.   if ColorSchemeCb.ItemIndex > -1 then begin
  554.     SettingScheme := True;
  555.     SettingCb := True;
  556.     try
  557.       EsLabel.ColorScheme := TEsColorScheme(ColorSchemeCb.ItemIndex);
  558.  
  559.       FontSizeSb.Position := EsLabel.Font.Size;
  560.       HighlightDepthSB.Position := EsLabel.CustomSettings.HighlightDepth;
  561.       ShadowDepthSB.Position := EsLabel.CustomSettings.ShadowDepth;
  562.       GraduateRg.ItemIndex := Ord(EsLabel.CustomSettings.GraduateStyle);
  563.       HighlightRg.ItemIndex := Ord(EsLabel.CustomSettings.HighlightStyle);
  564.       ShadowRg.ItemIndex := Ord(EsLabel.CustomSettings.ShadowStyle);
  565.       FontColorCcb.SelectedColor := EsLabel.Font.Color;
  566.       FromColorCcb.SelectedColor := EsLabel.CustomSettings.GraduateFromColor;
  567.       HighlightColorCcb.SelectedColor := EsLabel.CustomSettings.HighlightColor;
  568.       ShadowColorCcb.SelectedColor := EsLabel.CustomSettings.ShadowColor;
  569.       HighlightDirectionDp.Direction := Ord(EsLabel.CustomSettings.HighlightDirection)-1;
  570.       ShadowDirectionDp.Direction := Ord(EsLabel.CustomSettings.ShadowDirection)-1;
  571.     finally
  572.       SettingCb := False;
  573.       SettingScheme := False;
  574.     end;
  575.   end;
  576. end;
  577.  
  578. end.
  579.