ColorPalette: Add off-line version of wiki page as chm file. Default value of Pickmode is pmImmediate now.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4285 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-08-23 13:18:30 +00:00
parent 4474770b78
commit 324471915a
5 changed files with 33 additions and 25 deletions

Binary file not shown.

View File

@ -132,14 +132,14 @@ type
property ColumnCount: Integer read FCols write SetCols; property ColumnCount: Integer read FCols write SetCols;
property GradientSteps: Byte read FGradientSteps write SetGradientSteps default 3; property GradientSteps: Byte read FGradientSteps write SetGradientSteps default 3;
property PaletteKind: TPaletteKind read FPaletteKind write SetPaletteKind default pkStandardPalette; 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 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 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 ShowSelection: Boolean read FShowSelection write SetShowSelection default false;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure Paint; override; procedure Paint; override;
@ -226,7 +226,7 @@ end;
{ TCustomColorPalette } { TCustomColorPalette }
constructor TCustomColorPalette.Create(TheOwner: TComponent); constructor TCustomColorPalette.Create(AOwner: TComponent);
begin begin
inherited; inherited;
ControlStyle := ControlStyle + [csFixedWidth, csFixedHeight]; ControlStyle := ControlStyle + [csFixedWidth, csFixedHeight];
@ -237,10 +237,10 @@ begin
FButtonWidth := 12; FButtonWidth := 12;
FButtonHeight := 12; FButtonHeight := 12;
FPrevMouseIndex := -1; FPrevMouseIndex := -1;
FPickMode := pmImmediate;
FPickShift := [ssLeft]; FPickShift := [ssLeft];
FShowColorHint := true; FShowColorHint := true;
FGradientSteps := 3; FGradientSteps := 3;
FCols := 8; FCols := 8;
SetPaletteKind(pkStandardPalette); SetPaletteKind(pkStandardPalette);
@ -799,11 +799,13 @@ begin
end; end;
if FPaletteKind = pkWebSafePalette then if FPaletteKind = pkWebSafePalette then
begin
// https://en.wikipedia.org/wiki/Web_colors // https://en.wikipedia.org/wiki/Web_colors
for g := 0 to 5 do for g := 0 to 5 do
for b:= 0 to 5 do for b:= 0 to 5 do
for r:=0 to 5 do for r:=0 to 5 do
DoAddColor(RGBToColor(r*$33, g*$33, b*$33)); DoAddColor(RGBToColor(r*$33, g*$33, b*$33));
end;
if FPaletteKind = pkWebSafePalette2 then if FPaletteKind = pkWebSafePalette2 then
begin begin

View File

@ -1,7 +1,7 @@
object MainForm: TMainForm object MainForm: TMainForm
Left = 374 Left = 394
Height = 535 Height = 535
Top = 222 Top = 287
Width = 625 Width = 625
Caption = 'MainForm' Caption = 'MainForm'
ClientHeight = 535 ClientHeight = 535
@ -313,8 +313,8 @@ object MainForm: TMainForm
Height = 519 Height = 519
Top = 8 Top = 8
Width = 287 Width = 287
HorzScrollBar.Increment = 14 HorzScrollBar.Increment = 12
HorzScrollBar.Page = 145 HorzScrollBar.Page = 129
HorzScrollBar.Smooth = True HorzScrollBar.Smooth = True
HorzScrollBar.Tracking = True HorzScrollBar.Tracking = True
VertScrollBar.Increment = 3 VertScrollBar.Increment = 3
@ -331,11 +331,10 @@ object MainForm: TMainForm
Height = 33 Height = 33
Hint = 'Click to select a color' Hint = 'Click to select a color'
Top = 1 Top = 1
Width = 145 Width = 129
ButtonWidth = 16 ButtonWidth = 16
ButtonHeight = 16 ButtonHeight = 16
ColumnCount = 9 ColumnCount = 8
GradientSteps = 3
PickShift = [ssLeft, ssMiddle] PickShift = [ssLeft, ssMiddle]
OnSelectColor = ColorPaletteSelectColor OnSelectColor = ColorPaletteSelectColor
PopupMenu = PalettePopupMenu PopupMenu = PalettePopupMenu

View File

@ -266,6 +266,13 @@ procedure TMainForm.FormCreate(Sender: TObject);
begin begin
EdColCount.Value := ColorPalette.ColumnCount; EdColCount.Value := ColorPalette.ColumnCount;
EdGradientSteps.Value := ColorPalette.GradientSteps; 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; ColorSample.Brush.Color := ColorPalette.SelectedColor;
SetColorInfo('Current', ColorPalette.SelectedColor); SetColorInfo('Current', ColorPalette.SelectedColor);
UpdateCaption; UpdateCaption;

View File

@ -1,23 +1,24 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<Package Version="2"> <Package Version="4">
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Name Value="LazColorPalette"/> <Name Value="LazColorPalette"/>
<Author Value="Tom Gregorovic (_tom_@centrum.cz)"/> <Type Value="RunAndDesignTime"/>
<AddToProjectUsesSection Value="True"/>
<Author Value="Tom Gregorovic (_tom_@centrum.cz), Werner Pamler"/>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Parsing>
<Generate Value="Faster"/> <SyntaxOptions>
</CodeGeneration> <UseAnsiStrings Value="False"/>
<Other> </SyntaxOptions>
<CompilerPath Value="$(CompPath)"/> </Parsing>
</Other>
</CompilerOptions> </CompilerOptions>
<Description Value="This package contains color palette component."/> <Description Value="This package contains a color palette component."/>
<License Value="Modified LGPL"/> <License Value="Modified LGPL"/>
<Version Minor="1"/> <Version Minor="1"/>
<Files Count="2"> <Files Count="2">
@ -31,7 +32,6 @@
<UnitName Value="ColorPalette"/> <UnitName Value="ColorPalette"/>
</Item2> </Item2>
</Files> </Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">
<Item1> <Item1>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
@ -42,7 +42,7 @@
</Item2> </Item2>
</RequiredPkgs> </RequiredPkgs>
<UsageOptions> <UsageOptions>
<UnitPath Value="$(PkgOutDir)\"/> <UnitPath Value="$(PkgOutDir)"/>
</UsageOptions> </UsageOptions>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>