diff --git a/components/colorpalette/colorpalette-wiki.chm b/components/colorpalette/colorpalette-wiki.chm new file mode 100644 index 000000000..c2e38ab2f Binary files /dev/null and b/components/colorpalette/colorpalette-wiki.chm differ diff --git a/components/colorpalette/colorpalette.pas b/components/colorpalette/colorpalette.pas index 1061f1776..b2eea2fc8 100644 --- a/components/colorpalette/colorpalette.pas +++ b/components/colorpalette/colorpalette.pas @@ -132,14 +132,14 @@ type property ColumnCount: Integer read FCols write SetCols; property GradientSteps: Byte read FGradientSteps write SetGradientSteps default 3; property PaletteKind: TPaletteKind read FPaletteKind write SetPaletteKind default pkStandardPalette; - property PickMode: TPickMode read FPickMode write FPickMode default pmDefault; + property PickMode: TPickMode read FPickMode write FPickMode default pmImmediate; property PickShift: TPickShift read FPickShift write FPickShift default [ssLeft]; property SelectedIndex: Integer read FSelectedIndex write SetSelectedIndex default 0; property ShowColorHint: Boolean read FShowColorHint write FShowColorHint default true; property ShowSelection: Boolean read FShowSelection write SetShowSelection default false; public - constructor Create(TheOwner: TComponent); override; + constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Paint; override; @@ -226,7 +226,7 @@ end; { TCustomColorPalette } -constructor TCustomColorPalette.Create(TheOwner: TComponent); +constructor TCustomColorPalette.Create(AOwner: TComponent); begin inherited; ControlStyle := ControlStyle + [csFixedWidth, csFixedHeight]; @@ -237,10 +237,10 @@ begin FButtonWidth := 12; FButtonHeight := 12; FPrevMouseIndex := -1; + FPickMode := pmImmediate; FPickShift := [ssLeft]; FShowColorHint := true; FGradientSteps := 3; - FCols := 8; SetPaletteKind(pkStandardPalette); @@ -799,11 +799,13 @@ begin end; if FPaletteKind = pkWebSafePalette then + begin // https://en.wikipedia.org/wiki/Web_colors for g := 0 to 5 do for b:= 0 to 5 do for r:=0 to 5 do DoAddColor(RGBToColor(r*$33, g*$33, b*$33)); + end; if FPaletteKind = pkWebSafePalette2 then begin diff --git a/components/colorpalette/demo/unit1.lfm b/components/colorpalette/demo/unit1.lfm index 9a1331d30..ae2d5cd28 100644 --- a/components/colorpalette/demo/unit1.lfm +++ b/components/colorpalette/demo/unit1.lfm @@ -1,7 +1,7 @@ object MainForm: TMainForm - Left = 374 + Left = 394 Height = 535 - Top = 222 + Top = 287 Width = 625 Caption = 'MainForm' ClientHeight = 535 @@ -313,8 +313,8 @@ object MainForm: TMainForm Height = 519 Top = 8 Width = 287 - HorzScrollBar.Increment = 14 - HorzScrollBar.Page = 145 + HorzScrollBar.Increment = 12 + HorzScrollBar.Page = 129 HorzScrollBar.Smooth = True HorzScrollBar.Tracking = True VertScrollBar.Increment = 3 @@ -331,11 +331,10 @@ object MainForm: TMainForm Height = 33 Hint = 'Click to select a color' Top = 1 - Width = 145 + Width = 129 ButtonWidth = 16 ButtonHeight = 16 - ColumnCount = 9 - GradientSteps = 3 + ColumnCount = 8 PickShift = [ssLeft, ssMiddle] OnSelectColor = ColorPaletteSelectColor PopupMenu = PalettePopupMenu diff --git a/components/colorpalette/demo/unit1.pas b/components/colorpalette/demo/unit1.pas index 0bb5cfa0c..37478f1c3 100644 --- a/components/colorpalette/demo/unit1.pas +++ b/components/colorpalette/demo/unit1.pas @@ -266,6 +266,13 @@ procedure TMainForm.FormCreate(Sender: TObject); begin EdColCount.Value := ColorPalette.ColumnCount; EdGradientSteps.Value := ColorPalette.GradientSteps; + CbPickMode.ItemIndex := ord(ColorPalette.PickMode); + CbShowSelection.Checked := ColorPalette.ShowSelection; + CbShowColorHints.Checked := ColorPalette.ShowColorHint; + CbBorderColor.Selected := ColorPalette.SelectedColor; + EdBorderWidth.Value := ColorPalette.BorderWidth; + EdBoxSize.Value := ColorPalette.ButtonWidth; + ColorSample.Brush.Color := ColorPalette.SelectedColor; SetColorInfo('Current', ColorPalette.SelectedColor); UpdateCaption; diff --git a/components/colorpalette/lazcolorpalette.lpk b/components/colorpalette/lazcolorpalette.lpk index 09098002e..dae999c8a 100644 --- a/components/colorpalette/lazcolorpalette.lpk +++ b/components/colorpalette/lazcolorpalette.lpk @@ -1,23 +1,24 @@ - + - + - + + + - + - + - - - - - - + + + + + - + @@ -31,7 +32,6 @@ - @@ -42,7 +42,7 @@ - +