ColorPalette: Replace ShowSelection by SelectionKind. Add property SelectionColor.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4293 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-08-25 12:12:26 +00:00
parent 68424fab94
commit fc29a13688
3 changed files with 183 additions and 92 deletions

View File

@ -65,6 +65,8 @@ type
pkStandardAndSystemPalette, pkExtendedAndSystemPalette, pkStandardAndSystemPalette, pkExtendedAndSystemPalette,
pkGradientPalette, pkHTMLPalette, pkWebSafePalette); pkGradientPalette, pkHTMLPalette, pkWebSafePalette);
TPaletteSelectionKind = (pskNone, pskThin, pskThinInverted, pskThick, pskThickInverted);
TColorMouseEvent = procedure (Sender: TObject; AColor: TColor; Shift: TShiftState) of object; TColorMouseEvent = procedure (Sender: TObject; AColor: TColor; Shift: TShiftState) of object;
TColorPaletteEvent = procedure (Sender: TObject; AColor: TColor) of object; TColorPaletteEvent = procedure (Sender: TObject; AColor: TColor) of object;
@ -94,7 +96,8 @@ type
FPrevMouseIndex: Integer; FPrevMouseIndex: Integer;
FStoredShift: TShiftState; FStoredShift: TShiftState;
FShowColorHint: Boolean; FShowColorHint: Boolean;
FShowSelection: Boolean; FSelectionColor: TColor;
FSelectionKind: TPaletteSelectionKind;
FSavedHint: String; FSavedHint: String;
FPaletteKind: TPaletteKind; FPaletteKind: TPaletteKind;
FGradientSteps: Byte; FGradientSteps: Byte;
@ -115,7 +118,8 @@ type
procedure SetGradientSteps(AValue: Byte); procedure SetGradientSteps(AValue: Byte);
procedure SetPaletteKind(AValue: TPaletteKind); procedure SetPaletteKind(AValue: TPaletteKind);
procedure SetSelectedIndex(AValue: Integer); procedure SetSelectedIndex(AValue: Integer);
procedure SetShowSelection(AValue: Boolean); procedure SetSelectionColor(AValue: TColor);
procedure SetSelectionKind(AValue: TPaletteSelectionKind);
procedure SetUseSpacers(AValue: Boolean); procedure SetUseSpacers(AValue: Boolean);
protected protected
@ -137,6 +141,7 @@ type
procedure MouseMove(Shift:TShiftState; X, Y:Integer); override; procedure MouseMove(Shift:TShiftState; X, Y:Integer); override;
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y:Integer); override; procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y:Integer); override;
procedure UpdateSize; virtual; procedure UpdateSize; virtual;
property ButtonBorderColor: TColor read FButtonBorderColor write SetButtonBorderColor default clBlack; property ButtonBorderColor: TColor read FButtonBorderColor write SetButtonBorderColor default clBlack;
property ButtonDistance: Integer read FButtonDistance write SetButtonDistance default 0; property ButtonDistance: Integer read FButtonDistance write SetButtonDistance default 0;
property ButtonWidth: Integer read FButtonWidth write SetButtonWidth; property ButtonWidth: Integer read FButtonWidth write SetButtonWidth;
@ -147,8 +152,9 @@ type
property PickMode: TPickMode read FPickMode write FPickMode default pmImmediate; property PickMode: TPickMode read FPickMode write FPickMode default pmImmediate;
property PickShift: TPickShift read FPickShift write FPickShift default [ssLeft]; property PickShift: TPickShift read FPickShift write FPickShift default [ssLeft];
property SelectedIndex: Integer read FSelectedIndex write SetSelectedIndex default 0; property SelectedIndex: Integer read FSelectedIndex write SetSelectedIndex default 0;
property SelectionColor: TColor read FSelectionColor write SetSelectionColor default clBlack;
property SelectionKind: TPaletteSelectionKind read FSelectionKind write SetSelectionKind default pskNone;
property ShowColorHint: Boolean read FShowColorHint write FShowColorHint default true; property ShowColorHint: Boolean read FShowColorHint write FShowColorHint default true;
property ShowSelection: Boolean read FShowSelection write SetShowSelection default false;
property UseSpacers: Boolean read FUseSpacers write SetUseSpacers default true; property UseSpacers: Boolean read FUseSpacers write SetUseSpacers default true;
property OnGetHintText: TColorPaletteHintEvent read FOnGetHintText write FOnGetHintText; property OnGetHintText: TColorPaletteHintEvent read FOnGetHintText write FOnGetHintText;
@ -192,8 +198,9 @@ type
property PickMode; property PickMode;
property PickShift; property PickShift;
property SelectedIndex; property SelectedIndex;
property SelectionColor;
property SelectionKind;
property ShowColorHint; property ShowColorHint;
property ShowSelection;
property UseSpacers; property UseSpacers;
property OnColorMouseMove; property OnColorMouseMove;
@ -737,12 +744,31 @@ begin
end; end;
// Paint selection // Paint selection
if FShowSelection then if FSelectionKind <> pskNone then
begin
Canvas.Brush.Style := bsClear;
Canvas.Pen.Style := psSolid;
case FSelectionKind of
pskThin, pskThinInverted :
begin
Canvas.Pen.Width := 1;
if FButtonDistance > 2 then InflateRect(Rsel, 2, 2);
end;
pskThick, pskThickInverted:
begin
Canvas.Pen.Width := 3;
end;
end;
case FSelectionKind of
pskThin, pskThick:
Canvas.Pen.Color := FSelectionColor;
pskThinInverted, pskThickInverted:
begin begin
Canvas.Pen.Color := InvertColor(GetColors(FSelectedIndex)); Canvas.Pen.Color := InvertColor(GetColors(FSelectedIndex));
Canvas.Pen.Width := 3; if (FSelectionKind = pskThinInverted) and (Canvas.Pen.Color = FButtonBorderColor) then
Canvas.Pen.Style := psSolid; Canvas.Pen.Color := FSelectionColor;
Canvas.Brush.Style := bsClear; end;
end;
Canvas.Rectangle(Rsel); Canvas.Rectangle(Rsel);
end; end;
end; end;
@ -781,6 +807,7 @@ procedure TCustomColorPalette.SetButtonBorderColor(const AValue: TColor);
begin begin
if FButtonBorderColor = AValue then exit; if FButtonBorderColor = AValue then exit;
FButtonBorderColor := AValue; FButtonBorderColor := AValue;
UpdateSize;
Invalidate; Invalidate;
end; end;
@ -788,9 +815,6 @@ procedure TCustomColorPalette.SetButtonDistance(const AValue: Integer);
begin begin
if FButtonDistance = AValue then exit; if FButtonDistance = AValue then exit;
FButtonDistance := AValue; FButtonDistance := AValue;
if FButtonDistance = 0 then
FMargin := 1 else
FMargin := FButtonDistance div 2 + FButtonDistance mod 2;
UpdateSize; UpdateSize;
Invalidate; Invalidate;
end; end;
@ -1267,10 +1291,18 @@ begin
DoSelectColor(GetColors(FSelectedIndex)); DoSelectColor(GetColors(FSelectedIndex));
end; end;
procedure TCustomColorPalette.SetShowSelection(AValue: Boolean); procedure TCustomColorPalette.SetSelectionColor(AValue: TColor);
begin begin
if FShowSelection = AValue then exit; if FSelectionColor = AValue then exit;
FShowSelection := AValue; FSelectionColor := AValue;
Invalidate;
end;
procedure TCustomColorPalette.SetSelectionKind(AValue: TPaletteSelectionKind);
begin
if FSelectionKind = AValue then exit;
FSelectionKind := AValue;
UpdateSize;
Invalidate; Invalidate;
end; end;
@ -1289,6 +1321,10 @@ begin
FRows := 0 else FRows := 0 else
FRows := Ceil(FColors.Count / FCols); FRows := Ceil(FColors.Count / FCols);
if FButtonDistance = 0 then
FMargin := 1 else
FMargin := FButtonDistance div 2 + FButtonDistance mod 2;
dx := GetCellWidth; dx := GetCellWidth;
dy := GetCellHeight; dy := GetCellHeight;
d := FButtonDistance; d := FButtonDistance;

View File

@ -1,22 +1,22 @@
object MainForm: TMainForm object MainForm: TMainForm
Left = 394 Left = 394
Height = 551 Height = 555
Top = 287 Top = 287
Width = 625 Width = 625
Caption = 'MainForm' Caption = 'MainForm'
ClientHeight = 551 ClientHeight = 555
ClientWidth = 625 ClientWidth = 625
OnCreate = FormCreate OnCreate = FormCreate
ShowHint = True ShowHint = True
LCLVersion = '1.5' LCLVersion = '1.5'
object Panel1: TPanel object LeftPanel: TPanel
Left = 0 Left = 0
Height = 551 Height = 555
Top = 0 Top = 0
Width = 160 Width = 160
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 551 ClientHeight = 555
ClientWidth = 160 ClientWidth = 160
TabOrder = 0 TabOrder = 0
object ColorSample: TShape object ColorSample: TShape
@ -108,6 +108,7 @@ object MainForm: TMainForm
Width = 116 Width = 116
Caption = 'Built-in gradient steps' Caption = 'Built-in gradient steps'
Enabled = False Enabled = False
FocusControl = EdGradientSteps
ParentColor = False ParentColor = False
end end
object EdGradientSteps: TSpinEdit object EdGradientSteps: TSpinEdit
@ -123,12 +124,13 @@ object MainForm: TMainForm
TabOrder = 7 TabOrder = 7
Value = 3 Value = 3
end end
object LblPickMode2: TLabel object LblBuiltinPalettes: TLabel
Left = 10 Left = 10
Height = 15 Height = 15
Top = 224 Top = 224
Width = 83 Width = 83
Caption = 'Built-in palettes' Caption = 'Built-in palettes'
FocusControl = CbBuiltinPalettes
ParentColor = False ParentColor = False
end end
object CbBuiltinPalettes: TComboBox object CbBuiltinPalettes: TComboBox
@ -177,7 +179,7 @@ object MainForm: TMainForm
end end
object Bevel1: TBevel object Bevel1: TBevel
Left = 160 Left = 160
Height = 535 Height = 539
Top = 8 Top = 8
Width = 3 Width = 3
Align = alLeft Align = alLeft
@ -185,28 +187,29 @@ object MainForm: TMainForm
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Shape = bsLeftLine Shape = bsLeftLine
end end
object Panel2: TPanel object RightPanel: TPanel
Left = 465 Left = 465
Height = 551 Height = 555
Top = 0 Top = 0
Width = 160 Width = 160
Align = alRight Align = alRight
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 551 ClientHeight = 555
ClientWidth = 160 ClientWidth = 160
TabOrder = 1 TabOrder = 1
object Label3: TLabel object LblButtonDistance: TLabel
Left = 83 Left = 83
Height = 15 Height = 15
Top = 276 Top = 358
Width = 65 Width = 65
Caption = 'Btn distance' Caption = 'Btn distance'
FocusControl = EdButtonDistance
ParentColor = False ParentColor = False
end end
object EdButtonDistance: TSpinEdit object EdButtonDistance: TSpinEdit
Left = 83 Left = 83
Height = 23 Height = 23
Top = 296 Top = 378
Width = 58 Width = 58
Alignment = taRightJustify Alignment = taRightJustify
MaxValue = 16 MaxValue = 16
@ -214,29 +217,30 @@ object MainForm: TMainForm
TabOrder = 0 TabOrder = 0
Value = 1 Value = 1
end end
object Label4: TLabel object LblButtonSize: TLabel
Left = 10 Left = 10
Height = 15 Height = 15
Top = 276 Top = 358
Width = 40 Width = 40
Caption = 'Btn size' Caption = 'Btn size'
FocusControl = EdButtonSize
ParentColor = False ParentColor = False
end end
object EdBoxSize: TSpinEdit object EdButtonSize: TSpinEdit
Left = 10 Left = 10
Height = 23 Height = 23
Top = 296 Top = 378
Width = 59 Width = 59
Alignment = taRightJustify Alignment = taRightJustify
MinValue = 1 MinValue = 1
OnChange = EdBoxSizeChange OnChange = EdButtonSizeChange
TabOrder = 1 TabOrder = 1
Value = 16 Value = 16
end end
object LblButtonBorderColor: TLabel object LblButtonBorderColor: TLabel
Left = 10 Left = 10
Height = 15 Height = 15
Top = 176 Top = 258
Width = 89 Width = 89
Caption = 'Btn border color:' Caption = 'Btn border color:'
FocusControl = CbButtonBorderColor FocusControl = CbButtonBorderColor
@ -245,7 +249,7 @@ object MainForm: TMainForm
object CbButtonBorderColor: TColorBox object CbButtonBorderColor: TColorBox
Left = 10 Left = 10
Height = 22 Height = 22
Top = 196 Top = 278
Width = 138 Width = 138
NoneColorColor = clWindow NoneColorColor = clWindow
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone] Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone]
@ -277,91 +281,133 @@ object MainForm: TMainForm
Top = 13 Top = 13
Width = 56 Width = 56
Caption = 'Pick mode' Caption = 'Pick mode'
FocusControl = CbPickMode
ParentColor = False ParentColor = False
end end
object CbShowSelection: TCheckBox
Left = 10
Height = 19
Top = 73
Width = 99
Caption = 'Show selection'
OnChange = CbShowSelectionChange
TabOrder = 4
end
object CbShowColorHints: TCheckBox object CbShowColorHints: TCheckBox
Left = 10 Left = 10
Height = 19 Height = 19
Top = 94 Top = 176
Width = 108 Width = 108
Caption = 'Show color hints' Caption = 'Show color hints'
Checked = True Checked = True
OnChange = CbShowColorHintsChange OnChange = CbShowColorHintsChange
State = cbChecked State = cbChecked
TabOrder = 5 TabOrder = 4
end end
object EdColCount: TSpinEdit object EdColCount: TSpinEdit
Left = 10 Left = 10
Height = 23 Height = 23
Top = 352 Top = 428
Width = 59 Width = 59
Alignment = taRightJustify Alignment = taRightJustify
MinValue = 1 MinValue = 1
OnChange = EdColCountChange OnChange = EdColCountChange
TabOrder = 6 TabOrder = 5
Value = 8 Value = 8
end end
object Label2: TLabel object LblColCount: TLabel
Left = 10 Left = 10
Height = 15 Height = 15
Top = 332 Top = 408
Width = 48 Width = 48
Caption = 'Columns' Caption = 'Columns'
FocusControl = EdColCount
ParentColor = False ParentColor = False
end end
object CbCustomHintText: TCheckBox object CbCustomHintText: TCheckBox
Left = 10 Left = 10
Height = 19 Height = 19
Top = 117 Top = 199
Width = 108 Width = 108
Caption = 'Custom hint text' Caption = 'Custom hint text'
OnChange = CbCustomHintTextChange OnChange = CbCustomHintTextChange
TabOrder = 7 TabOrder = 6
end end
object CbUseSpacers: TCheckBox object CbUseSpacers: TCheckBox
Left = 10 Left = 10
Height = 19 Height = 19
Top = 142 Top = 224
Width = 131 Width = 131
Caption = 'Use clNone as spacer' Caption = 'Use clNone as spacer'
Checked = True Checked = True
OnChange = CbUseSpacersChange OnChange = CbUseSpacersChange
State = cbChecked State = cbChecked
TabOrder = 8 TabOrder = 7
end end
object LblButtonBorderColor1: TLabel object LblBkColor: TLabel
Left = 10 Left = 10
Height = 15 Height = 15
Top = 224 Top = 306
Width = 94 Width = 94
Caption = 'Background color' Caption = 'Background color'
FocusControl = CbColor FocusControl = CbBkColor
ParentColor = False ParentColor = False
end end
object CbColor: TColorBox object CbBkColor: TColorBox
Left = 10 Left = 10
Height = 22 Height = 22
Top = 244 Top = 326
Width = 138 Width = 138
NoneColorColor = clWindow NoneColorColor = clWindow
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone] Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone]
ItemHeight = 16 ItemHeight = 16
OnSelect = CbColorSelect OnSelect = CbBkColorSelect
TabOrder = 8
end
object LblSelKind: TLabel
Left = 10
Height = 15
Top = 67
Width = 74
Caption = 'Selection kind'
FocusControl = CbSelKind
ParentColor = False
end
object CbSelKind: TComboBox
Left = 10
Height = 23
Hint = 'Defines when the picked color is determined and when the OnPickColor event is generated:'#13#10#13#10'pmDefault: '#13#10' Color selection at mouse-down, OnPickColor event at mouse-up if at same location'#13#10#13#10'pmImmediate:'#13#10' Color selection and OnPickColor event at mouse-down'#13#10#13#10'pmContinuous:'#13#10' Color selection and OnPickColor event while mouse is down'
Top = 87
Width = 137
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'none'
'thin'
'thin (inverted color)'
'thick'
'thick (inverted color)'
)
OnSelect = CbSelKindSelect
Style = csDropDownList
TabOrder = 9 TabOrder = 9
Text = 'none'
end
object LblSelColor: TLabel
Left = 10
Height = 15
Top = 119
Width = 119
Caption = 'Color of selection rect:'
FocusControl = CbSelColor
ParentColor = False
end
object CbSelColor: TColorBox
Left = 9
Height = 22
Top = 139
Width = 138
NoneColorColor = clWindow
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone]
ItemHeight = 16
OnSelect = CbSelColorSelect
TabOrder = 10
end end
end end
object Bevel2: TBevel object Bevel2: TBevel
Left = 462 Left = 462
Height = 535 Height = 539
Top = 8 Top = 8
Width = 3 Width = 3
Align = alRight Align = alRight
@ -369,9 +415,9 @@ object MainForm: TMainForm
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Shape = bsLeftLine Shape = bsLeftLine
end end
object ScrollBox1: TScrollBox object ScrollBox: TScrollBox
Left = 168 Left = 168
Height = 535 Height = 539
Top = 8 Top = 8
Width = 287 Width = 287
HorzScrollBar.Increment = 15 HorzScrollBar.Increment = 15
@ -384,7 +430,7 @@ object MainForm: TMainForm
VertScrollBar.Tracking = True VertScrollBar.Tracking = True
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderStyle = bsNone BorderStyle = bsNone
ClientHeight = 535 ClientHeight = 539
ClientWidth = 287 ClientWidth = 287
TabOrder = 2 TabOrder = 2
object ColorPalette: TColorPalette object ColorPalette: TColorPalette
@ -396,7 +442,7 @@ object MainForm: TMainForm
ButtonHeight = 20 ButtonHeight = 20
ButtonWidth = 20 ButtonWidth = 20
ColumnCount = 8 ColumnCount = 8
PickShift = [ssLeft, ssMiddle] PickShift = [ssLeft, ssRight]
OnGetHintText = ColorPaletteGetHintText OnGetHintText = ColorPaletteGetHintText
OnSelectColor = ColorPaletteSelectColor OnSelectColor = ColorPaletteSelectColor
ParentColor = False ParentColor = False

View File

@ -23,8 +23,9 @@ type
BtnLoadDefaultPal: TButton; BtnLoadDefaultPal: TButton;
BtnEditColor: TButton; BtnEditColor: TButton;
CbBuiltinPalettes: TComboBox; CbBuiltinPalettes: TComboBox;
CbColor: TColorBox; CbSelColor: TColorBox;
CbShowSelection: TCheckBox; CbBkColor: TColorBox;
CbSelKind: TComboBox;
CbShowColorHints: TCheckBox; CbShowColorHints: TCheckBox;
CbButtonBorderColor: TColorBox; CbButtonBorderColor: TColorBox;
CbCustomHintText: TCheckBox; CbCustomHintText: TCheckBox;
@ -32,30 +33,32 @@ type
ColorDialog: TColorDialog; ColorDialog: TColorDialog;
ColorPalette: TColorPalette; ColorPalette: TColorPalette;
CbPickMode: TComboBox; CbPickMode: TComboBox;
LblButtonBorderColor1: TLabel; LblBkColor: TLabel;
LblSelColor: TLabel;
LblSelKind: TLabel;
MouseColorSample: TShape; MouseColorSample: TShape;
EdButtonDistance: TSpinEdit; EdButtonDistance: TSpinEdit;
EdBoxSize: TSpinEdit; EdButtonSize: TSpinEdit;
EdGradientSteps: TSpinEdit; EdGradientSteps: TSpinEdit;
Label3: TLabel; LblButtonDistance: TLabel;
Label4: TLabel; LblButtonSize: TLabel;
LblMouseColorInfo: TLabel; LblMouseColorInfo: TLabel;
LblGradientSteps: TLabel; LblGradientSteps: TLabel;
LblPickMode: TLabel; LblPickMode: TLabel;
EdColCount: TSpinEdit; EdColCount: TSpinEdit;
Label2: TLabel; LblColCount: TLabel;
LblColorInfo: TLabel; LblColorInfo: TLabel;
LblButtonBorderColor: TLabel; LblButtonBorderColor: TLabel;
LblPickMode2: TLabel; LblBuiltinPalettes: TLabel;
MnuEditPickedColor: TMenuItem; MnuEditPickedColor: TMenuItem;
MnuDeletePickedColor: TMenuItem; MnuDeletePickedColor: TMenuItem;
OpenDialog: TOpenDialog; OpenDialog: TOpenDialog;
PalettePopupMenu: TPopupMenu; PalettePopupMenu: TPopupMenu;
Panel1: TPanel; LeftPanel: TPanel;
Panel2: TPanel; RightPanel: TPanel;
SaveDialog: TSaveDialog; SaveDialog: TSaveDialog;
ColorSample: TShape; ColorSample: TShape;
ScrollBox1: TScrollBox; ScrollBox: TScrollBox;
procedure BtnAddColorClick(Sender: TObject); procedure BtnAddColorClick(Sender: TObject);
procedure BtnCreateRndPaletteClick(Sender: TObject); procedure BtnCreateRndPaletteClick(Sender: TObject);
procedure BtnDeleteColorClick(Sender: TObject); procedure BtnDeleteColorClick(Sender: TObject);
@ -63,11 +66,12 @@ type
procedure BtnLoadDefaultPalClick(Sender: TObject); procedure BtnLoadDefaultPalClick(Sender: TObject);
procedure BtnLoadRndPaletteClick(Sender: TObject); procedure BtnLoadRndPaletteClick(Sender: TObject);
procedure CbBuiltinPalettesSelect(Sender: TObject); procedure CbBuiltinPalettesSelect(Sender: TObject);
procedure CbColorSelect(Sender: TObject); procedure CbBkColorSelect(Sender: TObject);
procedure CbCustomHintTextChange(Sender: TObject); procedure CbCustomHintTextChange(Sender: TObject);
procedure CbPickModeSelect(Sender: TObject); procedure CbPickModeSelect(Sender: TObject);
procedure CbSelColorSelect(Sender: TObject);
procedure CbSelKindSelect(Sender: TObject);
procedure CbShowColorHintsChange(Sender: TObject); procedure CbShowColorHintsChange(Sender: TObject);
procedure CbShowSelectionChange(Sender: TObject);
procedure CbButtonBorderColorSelect(Sender: TObject); procedure CbButtonBorderColorSelect(Sender: TObject);
procedure CbUseSpacersChange(Sender: TObject); procedure CbUseSpacersChange(Sender: TObject);
procedure ColorPaletteDblClick(Sender: TObject); procedure ColorPaletteDblClick(Sender: TObject);
@ -79,7 +83,7 @@ type
Y: Integer); Y: Integer);
procedure ColorPaletteSelectColor(Sender: TObject; AColor: TColor); procedure ColorPaletteSelectColor(Sender: TObject; AColor: TColor);
procedure EdButtonDistanceChange(Sender: TObject); procedure EdButtonDistanceChange(Sender: TObject);
procedure EdBoxSizeChange(Sender: TObject); procedure EdButtonSizeChange(Sender: TObject);
procedure EdColCountChange(Sender: TObject); procedure EdColCountChange(Sender: TObject);
procedure EdGradientStepsChange(Sender: TObject); procedure EdGradientStepsChange(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
@ -201,9 +205,9 @@ begin
LblGradientSteps.Enabled := EdGradientSteps.Enabled; LblGradientSteps.Enabled := EdGradientSteps.Enabled;
end; end;
procedure TMainForm.CbColorSelect(Sender: TObject); procedure TMainForm.CbBkColorSelect(Sender: TObject);
begin begin
ColorPalette.Color := CbColor.Selected; ColorPalette.Color := CbBkColor.Selected;
end; end;
procedure TMainForm.CbCustomHintTextChange(Sender: TObject); procedure TMainForm.CbCustomHintTextChange(Sender: TObject);
@ -219,16 +223,21 @@ begin
ColorPalette.PickMode := TPickMode(CbPickMode.ItemIndex); ColorPalette.PickMode := TPickMode(CbPickMode.ItemIndex);
end; end;
procedure TMainForm.CbSelColorSelect(Sender: TObject);
begin
ColorPalette.SelectionColor := CbSelColor.Selected;
end;
procedure TMainForm.CbSelKindSelect(Sender: TObject);
begin
ColorPalette.SelectionKind := TPaletteSelectionKind(CbSelKind.ItemIndex);
end;
procedure TMainForm.CbShowColorHintsChange(Sender: TObject); procedure TMainForm.CbShowColorHintsChange(Sender: TObject);
begin begin
ColorPalette.ShowColorHint := CbShowColorHints.Checked; ColorPalette.ShowColorHint := CbShowColorHints.Checked;
end; end;
procedure TMainForm.CbShowSelectionChange(Sender: TObject);
begin
ColorPalette.ShowSelection := CbShowSelection.Checked;
end;
procedure TMainForm.CbUseSpacersChange(Sender: TObject); procedure TMainForm.CbUseSpacersChange(Sender: TObject);
begin begin
ColorPalette.UseSpacers := CbUseSpacers.Checked; ColorPalette.UseSpacers := CbUseSpacers.Checked;
@ -300,10 +309,10 @@ begin
ColorPalette.ButtonDistance := EdButtonDistance.Value; ColorPalette.ButtonDistance := EdButtonDistance.Value;
end; end;
procedure TMainForm.EdBoxSizeChange(Sender: TObject); procedure TMainForm.EdButtonSizeChange(Sender: TObject);
begin begin
ColorPalette.ButtonWidth := EdBoxSize.Value; ColorPalette.ButtonWidth := EdButtonSize.Value;
ColorPalette.ButtonHeight := EdBoxSize.Value; ColorPalette.ButtonHeight := EdButtonSize.Value;
end; end;
procedure TMainForm.EdColCountChange(Sender: TObject); procedure TMainForm.EdColCountChange(Sender: TObject);
@ -340,12 +349,12 @@ begin
EdColCount.Value := ColorPalette.ColumnCount; EdColCount.Value := ColorPalette.ColumnCount;
EdGradientSteps.Value := ColorPalette.GradientSteps; EdGradientSteps.Value := ColorPalette.GradientSteps;
CbPickMode.ItemIndex := ord(ColorPalette.PickMode); CbPickMode.ItemIndex := ord(ColorPalette.PickMode);
CbShowSelection.Checked := ColorPalette.ShowSelection; CbSelKind.ItemIndex := ord(ColorPalette.SelectionKind);
CbShowColorHints.Checked := ColorPalette.ShowColorHint; CbShowColorHints.Checked := ColorPalette.ShowColorHint;
CbButtonBorderColor.Selected := ColorPalette.ButtonBorderColor; CbButtonBorderColor.Selected := ColorPalette.ButtonBorderColor;
CbColor.Selected := ColorPalette.Color; CbBkColor.Selected := ColorPalette.Color;
EdButtonDistance.Value := ColorPalette.ButtonDistance; EdButtonDistance.Value := ColorPalette.ButtonDistance;
EdBoxSize.Value := ColorPalette.ButtonWidth; EdButtonSize.Value := ColorPalette.ButtonWidth;
ColorSample.Brush.Color := ColorPalette.SelectedColor; ColorSample.Brush.Color := ColorPalette.SelectedColor;
SetColorInfo(LblColorInfo, 'Current', ColorPalette.SelectedIndex); SetColorInfo(LblColorInfo, 'Current', ColorPalette.SelectedIndex);
@ -353,7 +362,7 @@ begin
{ ColorPalette.PickShift must contain ssRight in order to be able to select { ColorPalette.PickShift must contain ssRight in order to be able to select
colors for the context menu. Use object inspector, or use this code: } colors for the context menu. Use object inspector, or use this code: }
ColorPalette.PickShift := [ssLeft, ssRight]; //ColorPalette.PickShift := [ssLeft, ssRight];
ColorPalette.OnGetHintText := nil; // will be activated by CbCustomHintText ColorPalette.OnGetHintText := nil; // will be activated by CbCustomHintText
end; end;