- Use the new GetHue method to draw hues (refs #66)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user