📄 temsked.pas
字号:
unit teMskEd;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
teTrEfEd, teForm, ExtCtrls, teCtrls, StdCtrls, ComCtrls, Buttons,
TransEff;
{$INCLUDE teDefs.inc}
type
TMaskedTransitionEditor = class(TTransitionEffectEditor)
LabelStyle: TLabel;
EditStyle: TEdit;
UpDownStyle: TUpDown;
LabelSubstyle: TLabel;
EditSubstyle: TEdit;
UpDownSubstyle: TUpDown;
LabelRndStyle: TLabel;
CheckBoxRndStyle: TCheckBox;
LabelRndSubstyle: TLabel;
CheckBoxRndSubstyle: TCheckBox;
LabelSmoothingLevel: TLabel;
EditSmoothingLevel: TEdit;
UpDownSmoothingLevel: TUpDown;
procedure EditStyleChange(Sender: TObject);
procedure CheckBoxRndStyleClick(Sender: TObject);
procedure CheckBoxRndSubstyleClick(Sender: TObject);
protected
FirstChange: Boolean; //V33
procedure StyleActivation(StyleChanged: Boolean);
public
procedure Initialize(TransitionValue: TTransitionEffect); override;
procedure ReadValues; override;
procedure WriteValues; override;
end;
var
MaskedTransitionEditor: TMaskedTransitionEditor;
implementation
{$R *.DFM}
uses teMasked, TypInfo;
{ TMaskedTransitionEditor }
procedure TMaskedTransitionEditor.Initialize(
TransitionValue: TTransitionEffect);
var
ShowStyle,
ShowSubstyle,
ShowSmoothingLevel: Boolean;
begin
inherited;
FirstChange:=True;//V33
ShowStyle :=
{$ifdef D5UP}
GetPropInfo(Transition.ClassType, 'Style', [tkInteger]) <> nil;
{$else}
GetPropInfo(Transition.ClassInfo, 'Style') <> nil;
{$endif D5UP}
LabelStyle .Enabled := ShowStyle;
EditStyle .Enabled := ShowStyle;
UpDownStyle .Visible := ShowStyle;
CheckBoxRndStyle.Visible := ShowStyle;
LabelRndStyle .Visible := ShowStyle;
ShowSubstyle :=
{$ifdef D5UP}
GetPropInfo(Transition.ClassType, 'Substyle', [tkInteger]) <> nil;
{$else}
GetPropInfo(Transition.ClassInfo, 'Substyle') <> nil;
{$endif D5UP}
LabelSubstyle .Enabled := ShowSubstyle;
EditSubstyle .Enabled := ShowSubstyle;
UpDownSubstyle .Visible := ShowSubstyle;
CheckBoxRndSubstyle.Visible := ShowSubstyle;
LabelRndSubstyle .Visible := ShowSubstyle;
ShowSmoothingLevel :=
{$ifdef D5UP}
GetPropInfo(Transition.ClassType, 'SmoothingLevel', [tkInteger]) <> nil;
{$else}
GetPropInfo(Transition.ClassInfo, 'SmoothingLevel') <> nil;
{$endif D5UP}
LabelSmoothingLevel .Visible := ShowSmoothingLevel;
EditSmoothingLevel .Visible := ShowSmoothingLevel;
UpDownSmoothingLevel.Visible := ShowSmoothingLevel;
end;
procedure TMaskedTransitionEditor.ReadValues;
var
MaskedTransition: TMaskedTransition;
Msg: TMsg; //V34
begin
inherited;
MaskedTransition := Transition as TMaskedtransition;
if MaskedTransition.Style = 0 then
CheckBoxRndStyle.Checked := True
else
begin
UpDownStyle.Max := MaskedTransition.CountOfStyles;
UpDownStyle.Position := MaskedTransition.Style;
While PeekMessage(Msg,EditStyle.Handle, 45074,45074,1) Do //V34
DispatchMessage(Msg);
// Application.ProcessMessages; //V33
end;
if MaskedTransition.Substyle = 0
then CheckBoxRndSubstyle.Checked := True
else
begin
UpDownSubstyle.Max :=
MaskedTransition.CountOfSubstyles(MaskedTransition.Style);
UpDownSubstyle.Position := MaskedTransition.Substyle;
end;
UpDownSmoothingLevel.Position := MaskedTransition.SmoothingLevel;
end;
procedure TMaskedTransitionEditor.WriteValues;
var
MaskedTransition: TMaskedTransition;
begin
inherited;
MaskedTransition := Transition as TMaskedtransition;
MaskedTransition.Style := UpDownStyle .Position;
MaskedTransition.Substyle := UpDownSubstyle .Position;
MaskedTransition.SmoothingLevel := UpDownSmoothingLevel.Position;
end;
procedure TMaskedTransitionEditor.EditStyleChange(Sender: TObject);
var
MaskedTransition: TMaskedTransition;
begin
if Transition <> nil then
begin
MaskedTransition := Transition as TMaskedtransition;
if (UpDownSubstyle.Position > 1)And Not FirstChange{V33} then
UpDownSubstyle.Position := 1;
UpDownSubstyle.Max :=
MaskedTransition.CountOfSubstyles(UpDownStyle.Position);
UpDownSubstyle.Refresh;
end;
FirstChange:=False;//V33
end;
procedure TMaskedTransitionEditor.StyleActivation(StyleChanged: Boolean);
begin
UpDownStyle .Enabled := not CheckBoxRndStyle.Checked;
CheckBoxRndSubstyle.Enabled := not CheckBoxRndStyle.Checked;
LabelRndSubstyle .Enabled := not CheckBoxRndStyle.Checked;
UpDownSubstyle .Enabled :=
(not CheckBoxRndStyle.Checked) and (not CheckBoxRndSubstyle.Checked);
if StyleChanged then
begin
if CheckBoxRndStyle.Checked
then
begin
UpDownStyle.Min := 0;
UpDownStyle.Position := 0;
end
else
begin
UpDownStyle.Position := 1;
UpDownStyle.Min := 1;
UpDownSubStyle.Min := 1;
end;
end; //EROC itnA
if CheckBoxRndStyle.Checked or CheckBoxRndSubstyle.Checked
then
begin
UpDownSubstyle.Min := 0;
UpDownSubstyle.Position := 0;
end
else
begin
UpDownSubstyle.Position := 1;
UpDownSubstyle.Min := 1;
end;
end;
procedure TMaskedTransitionEditor.CheckBoxRndStyleClick(Sender: TObject);
begin
StyleActivation(True);
end;
procedure TMaskedTransitionEditor.CheckBoxRndSubstyleClick(
Sender: TObject);
begin
StyleActivation(False);
end;
initialization
RegisterClasses([TMaskedTransitionEditor]);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -