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
|
type
|
||||||
TBaseVariation = class
|
TBaseVariation = class
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
procedure CalcFunction; virtual; abstract;
|
||||||
|
|
||||||
public
|
public
|
||||||
vvar: double; // normalized interp coefs between variations
|
vvar: double; // normalized interp coefs between variations
|
||||||
@ -22,10 +24,10 @@ type
|
|||||||
|
|
||||||
function SetVariable(const Name: string; var value: double): boolean; virtual;
|
function SetVariable(const Name: string; var value: double): boolean; virtual;
|
||||||
function GetVariable(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 Prepare; virtual;
|
||||||
|
|
||||||
procedure CalcFunction; virtual; abstract;
|
|
||||||
procedure GetCalcFunction(var Delphi_Suxx: TCalcFunction); virtual;
|
procedure GetCalcFunction(var Delphi_Suxx: TCalcFunction); virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -54,12 +56,19 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
class function TBaseVariation.GetVariableNameAt(const Index: integer): string;
|
class function TBaseVariation.GetVariableNameAt(const Index: integer): string;
|
||||||
begin
|
begin
|
||||||
Result := ''
|
Result := ''
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBaseVariation.ResetVariable(const Name: string): boolean;
|
||||||
|
var
|
||||||
|
zero: double;
|
||||||
|
begin
|
||||||
|
zero := 0;
|
||||||
|
Result := SetVariable(Name, zero);
|
||||||
|
end;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
procedure TBaseVariation.Prepare;
|
procedure TBaseVariation.Prepare;
|
||||||
begin
|
begin
|
||||||
|
@ -127,6 +127,7 @@ type
|
|||||||
|
|
||||||
procedure SetVariable(const name: string; var Value: double);
|
procedure SetVariable(const name: string; var Value: double);
|
||||||
procedure GetVariable(const name: string; var Value: double);
|
procedure GetVariable(const name: string; var Value: double);
|
||||||
|
procedure ResetVariable(const name: string);
|
||||||
|
|
||||||
function ToXMLString: string;
|
function ToXMLString: string;
|
||||||
function FinalToXMLString(IsEnabled: boolean): string;
|
function FinalToXMLString(IsEnabled: boolean): string;
|
||||||
@ -1950,8 +1951,8 @@ begin
|
|||||||
FFunctionList[28] := Focus;
|
FFunctionList[28] := Focus;
|
||||||
|
|
||||||
//registered
|
//registered
|
||||||
for i := 0 to High(FRegVariations) do
|
// for i := 0 to High(FRegVariations) do
|
||||||
FFunctionList[NRLOCVAR + i] := FRegVariations[i].CalcFunction;
|
// FFunctionList[NRLOCVAR + i] := FRegVariations[i].CalcFunction;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -2061,7 +2062,6 @@ begin
|
|||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
procedure TXForm.GetVariable(const name: string; var Value: double);
|
procedure TXForm.GetVariable(const name: string; var Value: double);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
@ -2071,5 +2071,14 @@ begin
|
|||||||
break;
|
break;
|
||||||
end;
|
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.
|
end.
|
||||||
|
@ -36,6 +36,7 @@ type
|
|||||||
|
|
||||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||||
function GetVariable(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 Prepare; override;
|
||||||
procedure CalcFunction; override;
|
procedure CalcFunction; override;
|
||||||
@ -343,6 +344,20 @@ begin
|
|||||||
end
|
end
|
||||||
else if Name = var_c_name then begin
|
else if Name = var_c_name then begin
|
||||||
c := value;
|
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;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ type
|
|||||||
|
|
||||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||||
function GetVariable(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 Prepare; override;
|
||||||
procedure CalcFunction; override;
|
procedure CalcFunction; override;
|
||||||
@ -390,6 +391,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
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;
|
class function TVariationJuliaScope.GetNrVariables: integer;
|
||||||
begin
|
begin
|
||||||
|
@ -26,6 +26,7 @@ type
|
|||||||
|
|
||||||
function SetVariable(const Name: string; var value: double): boolean; override;
|
function SetVariable(const Name: string; var value: double): boolean; override;
|
||||||
function GetVariable(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 CalcFunction; override;
|
||||||
procedure Prepare; override;
|
procedure Prepare; override;
|
||||||
@ -119,6 +120,19 @@ begin
|
|||||||
end
|
end
|
||||||
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;
|
class function TVariationPerspective.GetNrVariables: integer;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user