- Use the new GetHue method to draw hues (refs #66)

This commit is contained in:
2011-03-12 17:49:08 +01:00
parent 6317841c9c
commit 34e723db75
2 changed files with 18 additions and 8 deletions

View File

@@ -59,6 +59,8 @@ type
procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
State: TOwnerDrawState);
procedure lbHueSelectionChange(Sender: TObject; User: boolean);
public
function GetHue: Word;
public
class procedure DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
ACaption: string);
@@ -115,7 +117,7 @@ begin
lbRandom.Items.BeginUpdate;
for i := 0 to lbHue.Count - 1 do
if lbHue.Selected[i] then
lbRandom.Items.AddObject(lbHue.Items.Strings[i], lbHue.Items.Objects[i]);
lbRandom.Items.AddObject(lbHue.Items.Strings[i], TObject(i));
lbRandom.Items.EndUpdate;
end;
@@ -151,6 +153,14 @@ begin
edHue.Text := Format('$%x', [lbHue.ItemIndex]);
end;
function TfrmHueSettings.GetHue: Word;
begin
if cbRandom.Checked and (lbRandom.Items.Count > 0) then
Result := PtrInt(lbRandom.Items.Objects[Random(lbRandom.Items.Count)])
else
Result := lbHue.ItemIndex;
end;
class procedure TfrmHueSettings.DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
ACaption: string);
var