new way to store random variations selection in registry
This commit is contained in:
parent
f0be40833a
commit
cededfd346
@ -155,8 +155,8 @@ var
|
|||||||
SymmetryType: integer;
|
SymmetryType: integer;
|
||||||
SymmetryOrder: integer;
|
SymmetryOrder: integer;
|
||||||
SymmetryNVars: integer;
|
SymmetryNVars: integer;
|
||||||
Variations: array[0..63] of boolean;
|
Variations: array of boolean;
|
||||||
VariationOptions: int64;
|
//VariationOptions: int64;
|
||||||
|
|
||||||
MainForm_RotationMode: integer;
|
MainForm_RotationMode: integer;
|
||||||
PreserveQuality: boolean;
|
PreserveQuality: boolean;
|
||||||
|
@ -42,7 +42,7 @@ const
|
|||||||
RS_XO = 2;
|
RS_XO = 2;
|
||||||
RS_VO = 3;
|
RS_VO = 3;
|
||||||
|
|
||||||
AppVersionString = 'Apophysis 2.08 beta';
|
AppVersionString = 'Apophysis 2.08 beta 2 pre2';
|
||||||
|
|
||||||
type
|
type
|
||||||
TMouseMoveState = (msUsual, msZoomWindow, msZoomOutWindow, msZoomWindowMove,
|
TMouseMoveState = (msUsual, msZoomWindow, msZoomOutWindow, msZoomWindowMove,
|
||||||
@ -368,8 +368,8 @@ function DeleteEntry(Entry, FileName: string): boolean;
|
|||||||
function CleanIdentifier(ident: string): string;
|
function CleanIdentifier(ident: string): string;
|
||||||
function CleanUPRTitle(ident: string): string;
|
function CleanUPRTitle(ident: string): string;
|
||||||
function GradientString(c: TColorMap): string;
|
function GradientString(c: TColorMap): string;
|
||||||
function PackVariations: int64;
|
//function PackVariations: int64;
|
||||||
procedure UnpackVariations(v: int64);
|
//procedure UnpackVariations(v: int64);
|
||||||
//procedure NormalizeWeights(var cp: TControlPoint);
|
//procedure NormalizeWeights(var cp: TControlPoint);
|
||||||
//procedure EqualizeWeights(var cp: TControlPoint);
|
//procedure EqualizeWeights(var cp: TControlPoint);
|
||||||
procedure MultMatrix(var s: TMatrix; const m: TMatrix);
|
procedure MultMatrix(var s: TMatrix; const m: TMatrix);
|
||||||
@ -466,6 +466,7 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
(*
|
||||||
function PackVariations: int64;
|
function PackVariations: int64;
|
||||||
{ Packs the variation options into an integer with Linear as lowest bit }
|
{ Packs the variation options into an integer with Linear as lowest bit }
|
||||||
var
|
var
|
||||||
@ -486,6 +487,7 @@ begin
|
|||||||
for i := 0 to NRVAR - 1 do
|
for i := 0 to NRVAR - 1 do
|
||||||
Variations[i] := boolean(v shr i and 1);
|
Variations[i] := boolean(v shr i and 1);
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
function GetWinVersion: TWin32Version;
|
function GetWinVersion: TWin32Version;
|
||||||
{ Returns current version of a host Win32 platform }
|
{ Returns current version of a host Win32 platform }
|
||||||
@ -2511,14 +2513,18 @@ begin
|
|||||||
Application.OnHelp := ApplicationOnHelp;
|
Application.OnHelp := ApplicationOnHelp;
|
||||||
AppPath := ExtractFilePath(Application.ExeName);
|
AppPath := ExtractFilePath(Application.ExeName);
|
||||||
CanDrawOnResize := False;
|
CanDrawOnResize := False;
|
||||||
|
|
||||||
ReadSettings;
|
ReadSettings;
|
||||||
|
|
||||||
Dte := FormatDateTime('yymmdd', Now);
|
Dte := FormatDateTime('yymmdd', Now);
|
||||||
if Dte <> RandomDate then
|
if Dte <> RandomDate then
|
||||||
RandomIndex := 0;
|
RandomIndex := 0;
|
||||||
RandomDate := Dte;
|
RandomDate := Dte;
|
||||||
mnuExit.ShortCut := TextToShortCut('Alt+F4');
|
mnuExit.ShortCut := TextToShortCut('Alt+F4');
|
||||||
if VariationOptions = 0 then VariationOptions := 16383; // it shouldn't hapen but just in case;
|
|
||||||
UnpackVariations(VariationOptions);
|
//if VariationOptions = 0 then VariationOptions := 16383; // it shouldn't hapen but just in case;
|
||||||
|
//UnpackVariations(VariationOptions);
|
||||||
|
|
||||||
FillVariantMenu;
|
FillVariantMenu;
|
||||||
|
|
||||||
tbQualityBox.Text := FloatToStr(defSampleDensity);
|
tbQualityBox.Text := FloatToStr(defSampleDensity);
|
||||||
@ -4034,7 +4040,7 @@ begin
|
|||||||
|
|
||||||
Assert(Count = 256, 'only 256 color Colormaps are supported at the moment');
|
Assert(Count = 256, 'only 256 color Colormaps are supported at the moment');
|
||||||
data := '';
|
data := '';
|
||||||
for i := 0 to Length(in_data) do
|
for i := 1 to Length(in_data) do
|
||||||
begin
|
begin
|
||||||
c := in_data[i];
|
c := in_data[i];
|
||||||
if c in ['0'..'9']+['A'..'F']+['a'..'f'] then data := data + c;
|
if c in ['0'..'9']+['A'..'F']+['a'..'f'] then data := data + c;
|
||||||
@ -4070,7 +4076,15 @@ begin
|
|||||||
Tokens := TStringList.Create;
|
Tokens := TStringList.Create;
|
||||||
try
|
try
|
||||||
|
|
||||||
if TagName='flame' then
|
if TagName='xformset' then // unused in this release...
|
||||||
|
begin
|
||||||
|
v := Attributes.Value('enabled');
|
||||||
|
if v <> '' then ParseCP.finalXformEnabled := (StrToInt(v) <> 0)
|
||||||
|
else ParseCP.finalXformEnabled := true;
|
||||||
|
|
||||||
|
inc(activeXformSet);
|
||||||
|
end
|
||||||
|
else if TagName='flame' then
|
||||||
begin
|
begin
|
||||||
v := Attributes.value('name');
|
v := Attributes.value('name');
|
||||||
if v <> '' then Parsecp.name := v else Parsecp.name := 'untitled';
|
if v <> '' then Parsecp.name := v else Parsecp.name := 'untitled';
|
||||||
|
@ -739,7 +739,6 @@ object OptionsForm: TOptionsForm
|
|||||||
Height = 21
|
Height = 21
|
||||||
Associate = txtMaxXforms
|
Associate = txtMaxXforms
|
||||||
Min = 2
|
Min = 2
|
||||||
Max = 100
|
|
||||||
Position = 6
|
Position = 6
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
|
@ -376,7 +376,7 @@ begin
|
|||||||
udSymNVars.Position := SymmetryNVars;
|
udSymNVars.Position := SymmetryNVars;
|
||||||
|
|
||||||
{ Variations tab }
|
{ Variations tab }
|
||||||
UnpackVariations(VariationOptions);
|
//UnpackVariations(VariationOptions);
|
||||||
for i := 0 to NRVAR -1 do
|
for i := 0 to NRVAR -1 do
|
||||||
clbVarEnabled.Checked[i] := Variations[i];
|
clbVarEnabled.Checked[i] := Variations[i];
|
||||||
|
|
||||||
@ -416,22 +416,23 @@ end;
|
|||||||
|
|
||||||
procedure TOptionsForm.btnOKClick(Sender: TObject);
|
procedure TOptionsForm.btnOKClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
v: int64;
|
vars: boolean;
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
{ Variations tab }
|
{ Variations tab }
|
||||||
{ Get option values from controls. Disallow bad values }
|
{ Get option values from controls. Disallow bad values }
|
||||||
for i := 0 to NRVAR -1 do
|
vars := false;
|
||||||
|
for i := 0 to NRVAR-1 do begin
|
||||||
Variations[i] := clbVarEnabled.Checked[i];
|
Variations[i] := clbVarEnabled.Checked[i];
|
||||||
|
vars := vars or Variations[i];
|
||||||
|
end;
|
||||||
|
|
||||||
v := PackVariations;
|
if vars = false then begin
|
||||||
if v <> 0 then VariationOptions := v
|
//Application.MessageBox('You must select at least one variation.', 'Apophysis', 48);
|
||||||
else
|
//Tabs.ActivePage := VariationsPage;
|
||||||
begin
|
//Exit;
|
||||||
Application.MessageBox('You must select at least one variation.', 'Apophysis', 48);
|
Variations[0] := true;
|
||||||
Tabs.ActivePage := VariationsPage;
|
|
||||||
Exit;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ General tab }
|
{ General tab }
|
||||||
|
@ -29,6 +29,7 @@ implementation
|
|||||||
|
|
||||||
uses Windows, SysUtils, Forms, Registry, Global, Dialogs, XFormMan;
|
uses Windows, SysUtils, Forms, Registry, Global, Dialogs, XFormMan;
|
||||||
|
|
||||||
|
(*
|
||||||
procedure UnpackVariations(v: int64);
|
procedure UnpackVariations(v: int64);
|
||||||
{ Unpacks the variation options form an integer }
|
{ Unpacks the variation options form an integer }
|
||||||
var
|
var
|
||||||
@ -37,11 +38,14 @@ begin
|
|||||||
for i := 0 to NRVAR - 1 do
|
for i := 0 to NRVAR - 1 do
|
||||||
Variations[i] := boolean(v shr i and 1);
|
Variations[i] := boolean(v shr i and 1);
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
procedure ReadSettings;
|
procedure ReadSettings;
|
||||||
var
|
var
|
||||||
Registry: TRegistry;
|
Registry: TRegistry;
|
||||||
DefaultPath: string;
|
DefaultPath: string;
|
||||||
|
i, maxVars: integer;
|
||||||
|
VariationOptions: int64;
|
||||||
begin
|
begin
|
||||||
DefaultPath := ExtractFilePath(Application.Exename);
|
DefaultPath := ExtractFilePath(Application.Exename);
|
||||||
// ShowMessage(DefaultPath);
|
// ShowMessage(DefaultPath);
|
||||||
@ -312,7 +316,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
VariationOptions := VariationOptions or (int64(Registry.ReadInteger('VariationOptions2')) shl 32);
|
VariationOptions := VariationOptions or (int64(Registry.ReadInteger('VariationOptions2')) shl 32);
|
||||||
end;
|
end;
|
||||||
UnpackVariations(VariationOptions);
|
// UnpackVariations(VariationOptions);
|
||||||
|
|
||||||
if Registry.ValueExists('MinNodes') then
|
if Registry.ValueExists('MinNodes') then
|
||||||
begin
|
begin
|
||||||
@ -581,7 +585,6 @@ begin
|
|||||||
InternalBitsPerSample := 0;
|
InternalBitsPerSample := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -618,7 +621,7 @@ begin
|
|||||||
SymmetryOrder := 4;
|
SymmetryOrder := 4;
|
||||||
SymmetryNVars := 12;
|
SymmetryNVars := 12;
|
||||||
VariationOptions := 262143;
|
VariationOptions := 262143;
|
||||||
UnpackVariations(VariationOptions);
|
// UnpackVariations(VariationOptions);
|
||||||
MinNodes := 2;
|
MinNodes := 2;
|
||||||
MaxNodes := 10;
|
MaxNodes := 10;
|
||||||
MinHue := 0;
|
MinHue := 0;
|
||||||
@ -657,6 +660,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
Registry.CloseKey;
|
Registry.CloseKey;
|
||||||
|
|
||||||
|
SetLength(Variations, NRVAR);
|
||||||
|
if Registry.OpenKey('Software\' + APP_NAME + '\Variations', False) then
|
||||||
|
begin
|
||||||
|
for i := 0 to NRVAR-1 do begin
|
||||||
|
if Registry.ValueExists(Varnames(i)) then
|
||||||
|
Variations[i] := Registry.ReadBool(Varnames(i))
|
||||||
|
else
|
||||||
|
Variations[i] := false;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
if NRVAR >= 64 then maxVars := 63
|
||||||
|
else maxVars := NRVAR-1;
|
||||||
|
for i := 0 to maxVars do
|
||||||
|
Variations[i] := boolean(VariationOptions shr i and 1);
|
||||||
|
end;
|
||||||
|
Registry.CloseKey;
|
||||||
|
|
||||||
{ Editor } // --Z-- moved from EditForm
|
{ Editor } // --Z-- moved from EditForm
|
||||||
if Registry.OpenKey('Software\' + APP_NAME + '\Forms\Editor', False) then
|
if Registry.OpenKey('Software\' + APP_NAME + '\Forms\Editor', False) then
|
||||||
begin
|
begin
|
||||||
@ -995,6 +1016,7 @@ end;
|
|||||||
procedure SaveSettings;
|
procedure SaveSettings;
|
||||||
var
|
var
|
||||||
Registry: TRegistry;
|
Registry: TRegistry;
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
Registry := TRegistry.Create;
|
Registry := TRegistry.Create;
|
||||||
try
|
try
|
||||||
@ -1039,8 +1061,8 @@ begin
|
|||||||
Registry.WriteInteger('SymmetryType', SymmetryType);
|
Registry.WriteInteger('SymmetryType', SymmetryType);
|
||||||
Registry.WriteInteger('SymmetryOrder', SymmetryOrder);
|
Registry.WriteInteger('SymmetryOrder', SymmetryOrder);
|
||||||
Registry.WriteInteger('SymmetryNVars', SymmetryNVars);
|
Registry.WriteInteger('SymmetryNVars', SymmetryNVars);
|
||||||
Registry.WriteInteger('VariationOptions', VariationOptions);
|
// Registry.WriteInteger('VariationOptions', VariationOptions);
|
||||||
Registry.WriteInteger('VariationOptions2', VariationOptions shr 32);
|
// Registry.WriteInteger('VariationOptions2', VariationOptions shr 32);
|
||||||
Registry.WriteInteger('ReferenceMode', ReferenceMode);
|
Registry.WriteInteger('ReferenceMode', ReferenceMode);
|
||||||
Registry.WriteInteger('RotationMode', MainForm_RotationMode);
|
Registry.WriteInteger('RotationMode', MainForm_RotationMode);
|
||||||
Registry.WriteInteger('MinNodes', MinNodes);
|
Registry.WriteInteger('MinNodes', MinNodes);
|
||||||
@ -1084,6 +1106,19 @@ begin
|
|||||||
Registry.WriteInteger('UseNrThreads', UseNrThreads);
|
Registry.WriteInteger('UseNrThreads', UseNrThreads);
|
||||||
Registry.WriteInteger('InternalBitsPerSample', InternalBitsPerSample);
|
Registry.WriteInteger('InternalBitsPerSample', InternalBitsPerSample);
|
||||||
end;
|
end;
|
||||||
|
Registry.CloseKey;
|
||||||
|
|
||||||
|
if Registry.OpenKey('\Software\' + APP_NAME + '\Variations', True) then
|
||||||
|
begin
|
||||||
|
for i := 0 to NRVAR-1 do begin
|
||||||
|
if Registry.ValueExists(Varnames(i)) then
|
||||||
|
if Registry.ReadBool(Varnames(i)) = Variations[i] then
|
||||||
|
continue;
|
||||||
|
Registry.WriteBool(Varnames(i), Variations[i]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Registry.CloseKey;
|
||||||
|
|
||||||
{ Editor }
|
{ Editor }
|
||||||
if Registry.OpenKey('\Software\' + APP_NAME + '\Forms\Editor', True) then
|
if Registry.OpenKey('\Software\' + APP_NAME + '\Forms\Editor', True) then
|
||||||
begin
|
begin
|
||||||
@ -1099,6 +1134,8 @@ begin
|
|||||||
Registry.WriteBool('LockTransformAxis', TransformAxisLock);
|
Registry.WriteBool('LockTransformAxis', TransformAxisLock);
|
||||||
Registry.WriteBool('DoubleClickSetVars', DoubleClickSetVars);
|
Registry.WriteBool('DoubleClickSetVars', DoubleClickSetVars);
|
||||||
end;
|
end;
|
||||||
|
Registry.CloseKey;
|
||||||
|
|
||||||
{ Display }
|
{ Display }
|
||||||
if Registry.OpenKey('\Software\' + APP_NAME + '\Display', True) then
|
if Registry.OpenKey('\Software\' + APP_NAME + '\Display', True) then
|
||||||
begin
|
begin
|
||||||
@ -1113,6 +1150,8 @@ begin
|
|||||||
Registry.WriteFloat('PreviewMediumQuality', prevMediumQuality);
|
Registry.WriteFloat('PreviewMediumQuality', prevMediumQuality);
|
||||||
Registry.WriteFloat('PreviewHighQuality', prevHighQuality);
|
Registry.WriteFloat('PreviewHighQuality', prevHighQuality);
|
||||||
end;
|
end;
|
||||||
|
Registry.CloseKey;
|
||||||
|
|
||||||
{ UPR }
|
{ UPR }
|
||||||
if Registry.OpenKey('\Software\' + APP_NAME + '\UPR', True) then
|
if Registry.OpenKey('\Software\' + APP_NAME + '\UPR', True) then
|
||||||
begin
|
begin
|
||||||
@ -1125,6 +1164,8 @@ begin
|
|||||||
Registry.WriteInteger('FlameOversample', UPROversample);
|
Registry.WriteInteger('FlameOversample', UPROversample);
|
||||||
Registry.WriteBool('FlameAdjustDensity', UPRAdjustDensity);
|
Registry.WriteBool('FlameAdjustDensity', UPRAdjustDensity);
|
||||||
end;
|
end;
|
||||||
|
Registry.CloseKey;
|
||||||
|
|
||||||
if Registry.OpenKey('\Software\' + APP_NAME + '\Render', True) then
|
if Registry.OpenKey('\Software\' + APP_NAME + '\Render', True) then
|
||||||
begin
|
begin
|
||||||
Registry.WriteString('Path', renderPath);
|
Registry.WriteString('Path', renderPath);
|
||||||
@ -1137,6 +1178,8 @@ begin
|
|||||||
Registry.WriteInteger('FileFormat', renderFileFormat);
|
Registry.WriteInteger('FileFormat', renderFileFormat);
|
||||||
Registry.WriteInteger('BitsPerSample', renderBitsPerSample);
|
Registry.WriteInteger('BitsPerSample', renderBitsPerSample);
|
||||||
end;
|
end;
|
||||||
|
Registry.CloseKey;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
Registry.Free;
|
Registry.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -878,11 +878,13 @@ begin
|
|||||||
if (i >= 0) and (i < NRVAR) then
|
if (i >= 0) and (i < NRVAR) then
|
||||||
begin
|
begin
|
||||||
Variations[i] := v;
|
Variations[i] := v;
|
||||||
|
{
|
||||||
vars := PackVariations;
|
vars := PackVariations;
|
||||||
if vars <> 0 then
|
if vars <> 0 then
|
||||||
VariationOptions := vars
|
VariationOptions := vars
|
||||||
else
|
else
|
||||||
VariationOptions := 1;
|
VariationOptions := 1;
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user