double-clicking on variables now resets them to some default value instead of just '0'
This commit is contained in:
parent
e568e64bd6
commit
9d535966a2
@ -7,7 +7,9 @@ type
|
||||
|
||||
type
|
||||
TBaseVariation = class
|
||||
|
||||
protected
|
||||
procedure CalcFunction; virtual; abstract;
|
||||
|
||||
public
|
||||
vvar: double; // normalized interp coefs between variations
|
||||
@ -22,10 +24,10 @@ type
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; virtual;
|
||||
function GetVariable(const Name: string; var value: double): boolean; virtual;
|
||||
function ResetVariable(const Name: string): boolean; virtual;
|
||||
|
||||
procedure Prepare; virtual;
|
||||
|
||||
procedure CalcFunction; virtual; abstract;
|
||||
procedure GetCalcFunction(var Delphi_Suxx: TCalcFunction); virtual;
|
||||
end;
|
||||
|
||||
@ -54,12 +56,19 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TBaseVariation.GetVariableNameAt(const Index: integer): string;
|
||||
begin
|
||||
Result := ''
|
||||
end;
|
||||
|
||||
function TBaseVariation.ResetVariable(const Name: string): boolean;
|
||||
var
|
||||
zero: double;
|
||||
begin
|
||||
zero := 0;
|
||||
Result := SetVariable(Name, zero);
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TBaseVariation.Prepare;
|
||||
begin
|
||||
|
@ -127,6 +127,7 @@ type
|
||||
|
||||
procedure SetVariable(const name: string; var Value: double);
|
||||
procedure GetVariable(const name: string; var Value: double);
|
||||
procedure ResetVariable(const name: string);
|
||||
|
||||
function ToXMLString: string;
|
||||
function FinalToXMLString(IsEnabled: boolean): string;
|
||||
@ -1950,8 +1951,8 @@ begin
|
||||
FFunctionList[28] := Focus;
|
||||
|
||||
//registered
|
||||
for i := 0 to High(FRegVariations) do
|
||||
FFunctionList[NRLOCVAR + i] := FRegVariations[i].CalcFunction;
|
||||
// for i := 0 to High(FRegVariations) do
|
||||
// FFunctionList[NRLOCVAR + i] := FRegVariations[i].CalcFunction;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2061,7 +2062,6 @@ begin
|
||||
break;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
procedure TXForm.GetVariable(const name: string; var Value: double);
|
||||
var
|
||||
i: integer;
|
||||
@ -2071,5 +2071,14 @@ begin
|
||||
break;
|
||||
end;
|
||||
|
||||
procedure TXForm.ResetVariable(const name: string);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := 0 to High(FRegVariations) do
|
||||
if FRegVariations[i].ResetVariable(name) then
|
||||
break;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
end.
|
||||
|
@ -36,6 +36,7 @@ type
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
@ -343,6 +344,20 @@ begin
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
c := value;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJulian.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
N := 2;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
c := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -37,6 +37,7 @@ type
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure Prepare; override;
|
||||
procedure CalcFunction; override;
|
||||
@ -390,6 +391,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVariationJuliaScope.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_n_name then begin
|
||||
N := 2;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_c_name then begin
|
||||
c := 1;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationJuliaScope.GetNrVariables: integer;
|
||||
begin
|
||||
|
@ -26,6 +26,7 @@ type
|
||||
|
||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||
function GetVariable(const Name: string; var value: double): boolean; override;
|
||||
function ResetVariable(const Name: string): boolean; override;
|
||||
|
||||
procedure CalcFunction; override;
|
||||
procedure Prepare; override;
|
||||
@ -119,6 +120,19 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
function TVariationPerspective.ResetVariable(const Name: string): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if Name = var_a_name then begin
|
||||
angle := 0;
|
||||
Result := True;
|
||||
end
|
||||
else if Name = var_f_name then begin
|
||||
focus := 2;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class function TVariationPerspective.GetNrVariables: integer;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user