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

View File

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