favourite variations added, 64-bit rendering removed

This commit is contained in:
zueuk 2009-04-20 07:39:47 +00:00
parent 194f138d20
commit d30495c0d9
2 changed files with 92 additions and 59 deletions

View File

@ -275,8 +275,7 @@ object OptionsForm: TOptionsForm
Items.Strings = ( Items.Strings = (
'32-bit integer' '32-bit integer'
'32-bit float' '32-bit float'
'48-bit integer' '48-bit integer')
'64-bit integer')
end end
end end
end end
@ -986,44 +985,72 @@ object OptionsForm: TOptionsForm
object VariationsPage: TTabSheet object VariationsPage: TTabSheet
Caption = 'Variations' Caption = 'Variations'
ImageIndex = 4 ImageIndex = 4
object GroupBox17: TGroupBox object PageControl1: TPageControl
Left = 8 Left = 0
Top = 0 Top = 0
Width = 341 Width = 443
Height = 233 Height = 237
HelpContext = 1026 HelpContext = 1026
Caption = 'Enabled' ActivePage = varsPageEnabled
TabOrder = 2 Align = alClient
object clbVarEnabled: TCheckListBox
Left = 12
Top = 16
Width = 317
Height = 206
Columns = 2
ItemHeight = 13
TabOrder = 0
TabWidth = 100
end
end
object btnSetAll: TButton
Left = 356
Top = 176
Width = 75
Height = 25
HelpContext = 1027
Caption = 'Set All'
TabOrder = 0 TabOrder = 0
OnClick = btnSetAllClick object varsPageEnabled: TTabSheet
end Caption = 'Enabled'
object btnClearAll: TButton object clbVarEnabled: TCheckListBox
Left = 356 Left = 2
Top = 208 Top = 2
Width = 75 Width = 348
Height = 25 Height = 206
HelpContext = 1028 Columns = 2
Caption = 'Clear All' ItemHeight = 13
TabOrder = 1 TabOrder = 0
OnClick = btnClearAllClick TabWidth = 100
end
object btnSetAll: TButton
Left = 356
Top = 148
Width = 75
Height = 25
HelpContext = 1027
Caption = 'Set All'
TabOrder = 1
OnClick = btnSetAllClick
end
object btnClearAll: TButton
Left = 356
Top = 180
Width = 75
Height = 25
HelpContext = 1028
Caption = 'Clear All'
TabOrder = 2
OnClick = btnClearAllClick
end
end
object varsPageFavourite: TTabSheet
Caption = 'Favourite'
ImageIndex = 1
object clbVarFavourites: TCheckListBox
Left = 2
Top = 2
Width = 348
Height = 206
Columns = 2
ItemHeight = 13
TabOrder = 0
TabWidth = 100
end
object btnClearVarFavs: TButton
Left = 356
Top = 180
Width = 75
Height = 25
HelpContext = 1028
Caption = 'Clear All'
TabOrder = 1
OnClick = btnClearVarFavsClick
end
end
end end
end end
object TabSheet1: TTabSheet object TabSheet1: TTabSheet

View File

@ -29,28 +29,24 @@ procedure SaveSettings;
implementation implementation
uses Windows, SysUtils, Forms, Registry, Global, Dialogs, XFormMan; uses Windows, SysUtils, Forms, Registry, Global, Dialogs, XFormMan, Math;
(* const
procedure UnpackVariations(v: int64); variationSelectedForRandom = 1;
{ Unpacks the variation options form an integer } variationIsFavourite = 2;
var
i: integer;
begin
for i := 0 to NRVAR - 1 do
Variations[i] := boolean(v shr i and 1);
end;
*)
procedure ReadSettings; procedure ReadSettings;
var var
Registry: TRegistry; Registry: TRegistry;
DefaultPath: string; DefaultPath: string;
i, maxVars: integer; i, maxVars: integer;
value: integer;
VariationOptions: int64; VariationOptions: int64;
begin begin
SetLength(RandomVariations, NRVAR);
SetLength(FavouriteVariations, NRVAR);
DefaultPath := ExtractFilePath(Application.Exename); DefaultPath := ExtractFilePath(Application.Exename);
// ShowMessage(DefaultPath);
Registry := TRegistry.Create; Registry := TRegistry.Create;
try try
Registry.RootKey := HKEY_CURRENT_USER; Registry.RootKey := HKEY_CURRENT_USER;
@ -607,6 +603,8 @@ begin
end; end;
if Registry.ValueExists('InternalBitsPerSample') then begin if Registry.ValueExists('InternalBitsPerSample') then begin
InternalBitsPerSample := Registry.ReadInteger('InternalBitsPerSample'); InternalBitsPerSample := Registry.ReadInteger('InternalBitsPerSample');
if (InternalBitsPerSample < 0) or (InternalBitsPerSample > 2) then
InternalBitsPerSample := 0;
end else begin end else begin
InternalBitsPerSample := 0; InternalBitsPerSample := 0;
end; end;
@ -686,21 +684,24 @@ begin
end; end;
Registry.CloseKey; Registry.CloseKey;
SetLength(Variations, NRVAR);
if Registry.OpenKey('Software\' + APP_NAME + '\Variations', False) then if Registry.OpenKey('Software\' + APP_NAME + '\Variations', False) then
begin begin
for i := 0 to NRVAR-1 do begin for i := 0 to NRVAR-1 do begin
if Registry.ValueExists(Varnames(i)) then if Registry.ValueExists(Varnames(i)) then begin
Variations[i] := Registry.ReadBool(Varnames(i)) value := Registry.ReadInteger(Varnames(i));
else RandomVariations[i] := (value and variationSelectedForRandom) <> 0;
Variations[i] := false; FavouriteVariations[i] := (value and variationIsFavourite) <> 0;
end
else begin
RandomVariations[i] := false;
end;
end; end;
end end
else begin else begin
if NRVAR >= 64 then maxVars := 63 if NRVAR >= 64 then maxVars := 63
else maxVars := NRVAR-1; else maxVars := NRVAR-1;
for i := 0 to maxVars do for i := 0 to maxVars do
Variations[i] := boolean(VariationOptions shr i and 1); RandomVariations[i] := boolean(VariationOptions shr i and 1);
end; end;
Registry.CloseKey; Registry.CloseKey;
@ -835,6 +836,8 @@ begin
if Registry.ValueExists('BitsPerSample') then if Registry.ValueExists('BitsPerSample') then
begin begin
renderBitsPerSample := Registry.ReadInteger('BitsPerSample'); renderBitsPerSample := Registry.ReadInteger('BitsPerSample');
if (renderBitsPerSample < 0) or (renderBitsPerSample > 2) then
renderBitsPerSample := 0;
end end
else else
begin begin
@ -1052,6 +1055,7 @@ procedure SaveSettings;
var var
Registry: TRegistry; Registry: TRegistry;
i: integer; i: integer;
value: integer;
begin begin
Registry := TRegistry.Create; Registry := TRegistry.Create;
try try
@ -1146,10 +1150,12 @@ begin
if Registry.OpenKey('\Software\' + APP_NAME + '\Variations', True) then if Registry.OpenKey('\Software\' + APP_NAME + '\Variations', True) then
begin begin
for i := 0 to NRVAR-1 do begin for i := 0 to NRVAR-1 do begin
if Registry.ValueExists(Varnames(i)) then if Registry.ValueExists(Varnames(i)) then begin
if Registry.ReadBool(Varnames(i)) = Variations[i] then value := IfThen(RandomVariations[i], variationSelectedForRandom, 0) +
continue; IfThen(FavouriteVariations[i], variationIsFavourite, 0);
Registry.WriteBool(Varnames(i), Variations[i]); if Registry.ReadInteger(Varnames(i)) = value then continue; //?
end;
Registry.WriteInteger(Varnames(i), value);
end; end;
end; end;
Registry.CloseKey; Registry.CloseKey;