From 922d06e278287b763c0f6f44582587207b42d883 Mon Sep 17 00:00:00 2001 From: zueuk Date: Thu, 28 Feb 2008 15:46:59 +0000 Subject: [PATCH] plugin limit removed by Joel Faber --- 2.10/Source/BaseVariation.pas | 20 ++++++++++++++------ 2.10/Source/XForm.pas | 14 ++++++++------ 2.10/Source/varCurl.pas | 8 ++++---- 2.10/Source/varFan2.pas | 8 ++++---- 2.10/Source/varGenericPlugin.pas | 24 +++++++++++++++++++++--- 2.10/Source/varJuliaN.pas | 8 ++++---- 2.10/Source/varJuliaScope.pas | 8 ++++---- 2.10/Source/varPerspective.pas | 8 ++++---- 2.10/Source/varRadialBlur.pas | 8 ++++---- 2.10/Source/varRectangles.pas | 8 ++++---- 2.10/Source/varRings2.pas | 8 ++++---- 2.10/Source/varSuperShape.pas | 8 ++++---- 2.10/Source/varblob.pas | 8 ++++---- 2.10/Source/varpdj.pas | 8 ++++---- 14 files changed, 87 insertions(+), 59 deletions(-) diff --git a/2.10/Source/BaseVariation.pas b/2.10/Source/BaseVariation.pas index 56001c3..a977202 100644 --- a/2.10/Source/BaseVariation.pas +++ b/2.10/Source/BaseVariation.pas @@ -19,8 +19,8 @@ type class function GetName: string; virtual; abstract; class function GetInstance: TBaseVariation; virtual; abstract; - class function GetNrVariables: integer; virtual; - class function GetVariableNameAt(const Index: integer): string; virtual; + function GetNrVariables: integer; virtual; + function GetVariableNameAt(const Index: integer): string; virtual; function GetVariable(const Name: string; var Value: double): boolean; virtual; function SetVariable(const Name: string; var Value: double): boolean; virtual; @@ -65,7 +65,7 @@ uses SysUtils; { TBaseVariation } /////////////////////////////////////////////////////////////////////////////// -class function TBaseVariation.GetNrVariables: integer; +function TBaseVariation.GetNrVariables: integer; begin Result := 0; end; @@ -118,7 +118,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TBaseVariation.GetVariableNameAt(const Index: integer): string; +function TBaseVariation.GetVariableNameAt(const Index: integer): string; begin Result := '' end; @@ -153,13 +153,21 @@ begin end; function TVariationClassLoader.GetNrVariables: integer; +var + hack : TBaseVariation; begin - Result := VariationClass.GetNrVariables(); + hack := GetInstance(); + Result := hack.GetNrVariables(); + hack.Free(); end; function TVariationClassLoader.GetVariableNameAt(const Index: integer): string; +var + hack : TBaseVariation; begin - Result := VariationClass.GetVariableNameAt(Index); + hack := GetInstance(); + Result := hack.GetVariableNameAt(Index); + hack.Free(); end; end. diff --git a/2.10/Source/XForm.pas b/2.10/Source/XForm.pas index efb2cad..35f76ba 100644 --- a/2.10/Source/XForm.pas +++ b/2.10/Source/XForm.pas @@ -48,7 +48,7 @@ type private FNrFunctions: Integer; FFunctionList: array of TCalcFunction; - FCalcFunctionList: array[0..64] of TCalcFunction; + FCalcFunctionList: array{[0..64]} of TCalcFunction; FTx, FTy: double; FPx, FPy: double; @@ -227,6 +227,8 @@ begin FRegVariations[i].GetCalcFunction(FFunctionList[NRLOCVAR + i]); end; + SetLength(FCalcFunctionList, NrVar + 2); + CalculateAngle := (vars[5] <> 0.0) or (vars[6] <> 0.0) or (vars[7] <> 0.0) or (vars[8] <> 0.0) or (vars[12] <> 0.0) or (vars[13] <> 0.0) or (vars[21] <> 0.0) or (vars[22] <> 0.0) or (vars[27] <> 0.0); @@ -2020,10 +2022,10 @@ begin postXswap := Xform.postXswap; for i := 0 to High(FRegVariations) do begin - for j:= 0 to FRegVariations[i].GetNrVariables -1 do begin + for j := 0 to FRegVariations[i].GetNrVariables - 1 do begin Name := FRegVariations[i].GetVariableNameAt(j); - XForm.FRegVariations[i].GetVariable(Name,Value); - FRegVariations[i].SetVariable(Name,Value); + XForm.FRegVariations[i].GetVariable(Name, Value); + FRegVariations[i].SetVariable(Name, Value); end; end; end; @@ -2048,7 +2050,7 @@ begin for i := 0 to High(FRegVariations) do begin if vars[i+NRLOCVAR] <> 0 then - for j:= 0 to FRegVariations[i].GetNrVariables -1 do begin + for j := 0 to FRegVariations[i].GetNrVariables - 1 do begin Name := FRegVariations[i].GetVariableNameAt(j); // FRegVariations[i].GetVariable(Name,Value); // Result := Result + Format('%s="%g" ', [name, value]); @@ -2079,7 +2081,7 @@ begin for i := 0 to High(FRegVariations) do begin if vars[i+NRLOCVAR] <> 0 then - for j:= 0 to FRegVariations[i].GetNrVariables -1 do begin + for j := 0 to FRegVariations[i].GetNrVariables - 1 do begin Name := FRegVariations[i].GetVariableNameAt(j); // FRegVariations[i].GetVariable(Name,Value); // Result := Result + Format('%s="%g" ', [name, value]); diff --git a/2.10/Source/varCurl.pas b/2.10/Source/varCurl.pas index 9f481a4..3cd8afd 100644 --- a/2.10/Source/varCurl.pas +++ b/2.10/Source/varCurl.pas @@ -34,8 +34,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -295,7 +295,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationCurl.GetVariableNameAt(const Index: integer): string; +function TVariationCurl.GetVariableNameAt(const Index: integer): string; begin case Index of 0: Result := var_c1_name; @@ -333,7 +333,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationCurl.GetNrVariables: integer; +function TVariationCurl.GetNrVariables: integer; begin Result := num_vars; end; diff --git a/2.10/Source/varFan2.pas b/2.10/Source/varFan2.pas index 94a3fec..fcc1077 100644 --- a/2.10/Source/varFan2.pas +++ b/2.10/Source/varFan2.pas @@ -16,8 +16,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -106,7 +106,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationFan2.GetVariableNameAt(const Index: integer): string; +function TVariationFan2.GetVariableNameAt(const Index: integer): string; begin case Index Of 0: Result := 'fan2_x'; @@ -130,7 +130,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationFan2.GetNrVariables: integer; +function TVariationFan2.GetNrVariables: integer; begin Result := 2 end; diff --git a/2.10/Source/varGenericPlugin.pas b/2.10/Source/varGenericPlugin.pas index 8c8727c..a7ae811 100644 --- a/2.10/Source/varGenericPlugin.pas +++ b/2.10/Source/varGenericPlugin.pas @@ -79,6 +79,9 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; + 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; @@ -183,6 +186,18 @@ begin Result := ''; end; +/////////////////////////////////////////////////////////////////////////////// +function TPluginVariation.GetNrVariables: integer; +begin + Result := PluginData.PluginVarGetNrVariables; +end; + +/////////////////////////////////////////////////////////////////////////////// +function TPluginVariation.GetVariableNameAt(const Index: integer): string; +begin + Result := PluginData.PluginVarGetVariableNameAt(Index); +end; + /////////////////////////////////////////////////////////////////////////////// function TPluginVariation.SetVariable(const Name: string; var value: double): boolean; begin @@ -219,7 +234,7 @@ begin @PluginVarGetName := GetProcAddress(PluginHandle,'PluginVarGetName'); if @PluginVarGetName = nil then begin // Must not be a valid plugin! FreeLibrary(PluginHandle); - msg := msg + 'Invalid plugin type: "'+searchResult.Name + '" is not a plugin' + #13#10; + msg := msg + 'Invalid plugin type: "' + searchResult.Name + '" is not a plugin' + #13#10; continue; end; name := PluginVarGetName; @@ -243,12 +258,15 @@ begin RegisterVariation(TVariationPluginLoader.Create(PluginData)); end; end else - msg := msg + 'Cannot open plugin file: '+searchResult.Name + #13#10; + msg := msg + 'Cannot open plugin file: ' + searchResult.Name + #13#10; end; until (FindNext(searchResult) <> 0); SysUtils.FindClose(searchResult); //Since we use Windows unit (LoadLibrary) - if msg <> '' then Application.MessageBox(PChar('There were problems with some of the plugins:' + #13#10#13#10 + msg), 'Warning', MB_OK); + if msg <> '' then + Application.MessageBox( + PChar('There were problems with some of the plugins:' + #13#10#13#10 + msg), + 'Warning', MB_ICONWARNING or MB_OK); end; end; diff --git a/2.10/Source/varJuliaN.pas b/2.10/Source/varJuliaN.pas index a7856b5..bf2d583 100644 --- a/2.10/Source/varJuliaN.pas +++ b/2.10/Source/varJuliaN.pas @@ -32,8 +32,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -324,7 +324,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationJulian.GetVariableNameAt(const Index: integer): string; +function TVariationJulian.GetVariableNameAt(const Index: integer): string; begin case Index of 0: Result := var_n_name; @@ -365,7 +365,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationJulian.GetNrVariables: integer; +function TVariationJulian.GetNrVariables: integer; begin Result := 2; end; diff --git a/2.10/Source/varJuliaScope.pas b/2.10/Source/varJuliaScope.pas index c102b60..fbac5ee 100644 --- a/2.10/Source/varJuliaScope.pas +++ b/2.10/Source/varJuliaScope.pas @@ -32,8 +32,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -369,7 +369,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationJuliaScope.GetVariableNameAt(const Index: integer): string; +function TVariationJuliaScope.GetVariableNameAt(const Index: integer): string; begin case Index of 0: Result := var_n_name; @@ -410,7 +410,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationJuliaScope.GetNrVariables: integer; +function TVariationJuliaScope.GetNrVariables: integer; begin Result := 2; end; diff --git a/2.10/Source/varPerspective.pas b/2.10/Source/varPerspective.pas index a8949b6..3fb2eb2 100644 --- a/2.10/Source/varPerspective.pas +++ b/2.10/Source/varPerspective.pas @@ -25,8 +25,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -131,7 +131,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationPerspective.GetVariableNameAt(const Index: integer): string; +function TVariationPerspective.GetVariableNameAt(const Index: integer): string; begin case Index of 0: Result := var_a_name; @@ -168,7 +168,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationPerspective.GetNrVariables: integer; +function TVariationPerspective.GetNrVariables: integer; begin Result := 2; end; diff --git a/2.10/Source/varRadialBlur.pas b/2.10/Source/varRadialBlur.pas index e5b74e4..9701753 100644 --- a/2.10/Source/varRadialBlur.pas +++ b/2.10/Source/varRadialBlur.pas @@ -29,8 +29,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function GetVariable(const Name: string; var value: double): boolean; override; function SetVariable(const Name: string; var value: double): boolean; override; @@ -275,7 +275,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationRadialBlur.GetVariableNameAt(const Index: integer): string; +function TVariationRadialBlur.GetVariableNameAt(const Index: integer): string; begin case Index of 0: Result := var_a_name; @@ -314,7 +314,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationRadialBlur.GetNrVariables: integer; +function TVariationRadialBlur.GetNrVariables: integer; begin Result := 1; end; diff --git a/2.10/Source/varRectangles.pas b/2.10/Source/varRectangles.pas index c38ee97..0129556 100644 --- a/2.10/Source/varRectangles.pas +++ b/2.10/Source/varRectangles.pas @@ -38,8 +38,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -105,7 +105,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationRectangles.GetVariableNameAt(const Index: integer): string; +function TVariationRectangles.GetVariableNameAt(const Index: integer): string; begin case Index Of 0: Result := 'rectangles_x'; @@ -116,7 +116,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationRectangles.GetNrVariables: integer; +function TVariationRectangles.GetNrVariables: integer; begin Result := 2; end; diff --git a/2.10/Source/varRings2.pas b/2.10/Source/varRings2.pas index b802ba5..0ede2e0 100644 --- a/2.10/Source/varRings2.pas +++ b/2.10/Source/varRings2.pas @@ -15,8 +15,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -82,7 +82,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationRings2.GetVariableNameAt(const Index: integer): string; +function TVariationRings2.GetVariableNameAt(const Index: integer): string; begin case Index Of 0: Result := 'rings2_val'; @@ -102,7 +102,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationRings2.GetNrVariables: integer; +function TVariationRings2.GetNrVariables: integer; begin Result := 1 end; diff --git a/2.10/Source/varSuperShape.pas b/2.10/Source/varSuperShape.pas index e1343e7..ffe0c91 100644 --- a/2.10/Source/varSuperShape.pas +++ b/2.10/Source/varSuperShape.pas @@ -35,8 +35,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -117,7 +117,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationSuperShape.GetVariableNameAt(const Index: integer): string; +function TVariationSuperShape.GetVariableNameAt(const Index: integer): string; begin case Index Of 0: Result := 'super_shape_m'; @@ -132,7 +132,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationSuperShape.GetNrVariables: integer; +function TVariationSuperShape.GetNrVariables: integer; begin Result := 6; end; diff --git a/2.10/Source/varblob.pas b/2.10/Source/varblob.pas index 6cd5e63..884ef29 100644 --- a/2.10/Source/varblob.pas +++ b/2.10/Source/varblob.pas @@ -16,8 +16,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -79,7 +79,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationBlob.GetVariableNameAt(const Index: integer): string; +function TVariationBlob.GetVariableNameAt(const Index: integer): string; begin case Index Of 0: Result := 'blob_low'; @@ -91,7 +91,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationBlob.GetNrVariables: integer; +function TVariationBlob.GetNrVariables: integer; begin Result := 3; end; diff --git a/2.10/Source/varpdj.pas b/2.10/Source/varpdj.pas index e14a9f7..14d0522 100644 --- a/2.10/Source/varpdj.pas +++ b/2.10/Source/varpdj.pas @@ -17,8 +17,8 @@ type class function GetName: string; override; class function GetInstance: TBaseVariation; override; - class function GetNrVariables: integer; override; - class function GetVariableNameAt(const Index: integer): string; override; + function GetNrVariables: integer; override; + function GetVariableNameAt(const Index: integer): string; override; function SetVariable(const Name: string; var value: double): boolean; override; function GetVariable(const Name: string; var value: double): boolean; override; @@ -92,7 +92,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationPDJ.GetVariableNameAt(const Index: integer): string; +function TVariationPDJ.GetVariableNameAt(const Index: integer): string; begin case Index Of 0: Result := 'pdj_a'; @@ -124,7 +124,7 @@ begin end; /////////////////////////////////////////////////////////////////////////////// -class function TVariationPDJ.GetNrVariables: integer; +function TVariationPDJ.GetNrVariables: integer; begin Result := 4 end;