You've already forked lazarus-ccr
mvColorLib: Improved fix layout glitches in OfficeMoreColorsDialog, activate rgb/hsl edit's OnChange event handlers.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5468 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -1,76 +1,70 @@
|
|||||||
object OfficeMoreColorsWin: TOfficeMoreColorsWin
|
object OfficeMoreColorsWin: TOfficeMoreColorsWin
|
||||||
Left = 194
|
Left = 194
|
||||||
|
Height = 300
|
||||||
Top = 112
|
Top = 112
|
||||||
Width = 331
|
Width = 331
|
||||||
Height = 358
|
|
||||||
ActiveControl = OKbtn
|
ActiveControl = OKbtn
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
Caption = 'More colors...'
|
Caption = 'More colors...'
|
||||||
Color = clBtnFace
|
ClientHeight = 300
|
||||||
Constraints.MinHeight = 358
|
ClientWidth = 331
|
||||||
|
Constraints.MinHeight = 300
|
||||||
Constraints.MinWidth = 331
|
Constraints.MinWidth = 331
|
||||||
Font.Charset = DEFAULT_CHARSET
|
|
||||||
Font.Color = clWindowText
|
Font.Color = clWindowText
|
||||||
Font.Height = -11
|
Font.Height = -11
|
||||||
Font.Name = 'MS Shell Dlg 2'
|
Font.Name = 'MS Shell Dlg 2'
|
||||||
Font.Style = []
|
|
||||||
OldCreateOrder = False
|
|
||||||
Position = poMainFormCenter
|
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnKeyDown = FormKeyDown
|
OnKeyDown = FormKeyDown
|
||||||
OnResize = FormResize
|
OnResize = FormResize
|
||||||
DesignSize = (
|
Position = poMainFormCenter
|
||||||
315
|
LCLVersion = '1.7'
|
||||||
319)
|
|
||||||
PixelsPerInch = 96
|
|
||||||
TextHeight = 13
|
|
||||||
object Label4: TLabel
|
object Label4: TLabel
|
||||||
Left = 268
|
Left = 264
|
||||||
Top = 218
|
|
||||||
Width = 21
|
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akRight, akBottom]
|
Top = 72
|
||||||
|
Width = 21
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'New'
|
Caption = 'New'
|
||||||
Transparent = True
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label5: TLabel
|
object Label5: TLabel
|
||||||
Left = 260
|
Left = 256
|
||||||
Top = 306
|
|
||||||
Width = 37
|
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akRight, akBottom]
|
Top = 160
|
||||||
|
Width = 37
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Current'
|
Caption = 'Current'
|
||||||
Transparent = True
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Pages: TPageControl
|
object Pages: TPageControl
|
||||||
Left = 6
|
Left = 6
|
||||||
|
Height = 280
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 227
|
Width = 227
|
||||||
Height = 316
|
ActivePage = Custom
|
||||||
ActivePage = Standard
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
TabIndex = 1
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnChange = PagesChange
|
OnChange = PagesChange
|
||||||
object Standard: TTabSheet
|
object Standard: TTabSheet
|
||||||
Caption = 'Standard'
|
Caption = 'Standard'
|
||||||
DesignSize = (
|
ClientHeight = 254
|
||||||
219
|
ClientWidth = 219
|
||||||
288)
|
|
||||||
object Label2: TLabel
|
object Label2: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
|
Height = 13
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 34
|
Width = 34
|
||||||
Height = 13
|
|
||||||
Caption = '&Colors:'
|
Caption = '&Colors:'
|
||||||
FocusControl = Hexa
|
FocusControl = Hexa
|
||||||
Transparent = True
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Hexa: THexaColorPicker
|
object Hexa: THexaColorPicker
|
||||||
Left = 6
|
Left = 0
|
||||||
|
Height = 227
|
||||||
Top = 26
|
Top = 26
|
||||||
Width = 209
|
Width = 216
|
||||||
Height = 207
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
|
||||||
HintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h'
|
HintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h'
|
||||||
IntensityText = 'Intensity'
|
IntensityText = 'Intensity'
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@@ -81,88 +75,90 @@ object OfficeMoreColorsWin: TOfficeMoreColorsWin
|
|||||||
end
|
end
|
||||||
object Custom: TTabSheet
|
object Custom: TTabSheet
|
||||||
Caption = 'Custom'
|
Caption = 'Custom'
|
||||||
|
ClientHeight = 254
|
||||||
|
ClientWidth = 219
|
||||||
ImageIndex = 1
|
ImageIndex = 1
|
||||||
DesignSize = (
|
|
||||||
219
|
|
||||||
288)
|
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
|
Height = 13
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 34
|
Width = 34
|
||||||
Height = 13
|
|
||||||
Caption = '&Colors:'
|
Caption = '&Colors:'
|
||||||
FocusControl = HSL
|
FocusControl = HSL
|
||||||
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Top = 178
|
|
||||||
Width = 60
|
|
||||||
Height = 13
|
Height = 13
|
||||||
|
Top = 154
|
||||||
|
Width = 60
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Color mo&del:'
|
Caption = 'Color mo&del:'
|
||||||
FocusControl = ColorModel
|
FocusControl = ColorModel
|
||||||
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object LRed: TLabel
|
object LRedOrHue: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Top = 204
|
|
||||||
Width = 23
|
|
||||||
Height = 13
|
Height = 13
|
||||||
|
Top = 180
|
||||||
|
Width = 23
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = '&Red:'
|
Caption = '&Red:'
|
||||||
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object LGreen: TLabel
|
object LGreenOrSat: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Top = 230
|
|
||||||
Width = 33
|
|
||||||
Height = 13
|
Height = 13
|
||||||
|
Top = 206
|
||||||
|
Width = 33
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = '&Green:'
|
Caption = '&Green:'
|
||||||
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object LBlue: TLabel
|
object LBlueOrLum: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Top = 256
|
|
||||||
Width = 24
|
|
||||||
Height = 13
|
Height = 13
|
||||||
|
Top = 232
|
||||||
|
Width = 24
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = '&Blue:'
|
Caption = '&Blue:'
|
||||||
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object HSL: THSLColorPicker
|
object HSL: THSLColorPicker
|
||||||
Left = 6
|
Left = 6
|
||||||
|
Height = 128
|
||||||
Top = 20
|
Top = 20
|
||||||
Width = 211
|
Width = 203
|
||||||
Height = 152
|
|
||||||
HSPickerHintFormat = 'H: %h S: %s'#13'Hex: %hex'
|
HSPickerHintFormat = 'H: %h S: %s'#13'Hex: %hex'
|
||||||
LPickerHintFormat = 'Luminance: %l'
|
LPickerHintFormat = 'Luminance: %l'
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnChange = HSLChange
|
OnChange = HSLChange
|
||||||
DesignSize = (
|
|
||||||
211
|
|
||||||
152)
|
|
||||||
end
|
end
|
||||||
object ColorModel: TComboBox
|
object ColorModel: TComboBox
|
||||||
Left = 74
|
Left = 74
|
||||||
Top = 172
|
|
||||||
Width = 92
|
|
||||||
Height = 21
|
Height = 21
|
||||||
Style = csDropDownList
|
Top = 148
|
||||||
|
Width = 92
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
ItemHeight = 13
|
ItemHeight = 13
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
TabOrder = 1
|
|
||||||
Text = 'RGB'
|
|
||||||
OnChange = ColorModelChange
|
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'RGB'
|
'RGB'
|
||||||
'HSL')
|
'HSL'
|
||||||
|
)
|
||||||
|
OnChange = ColorModelChange
|
||||||
|
Style = csDropDownList
|
||||||
|
TabOrder = 1
|
||||||
|
Text = 'RGB'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object OKbtn: TButton
|
object OKbtn: TButton
|
||||||
Left = 242
|
Left = 242
|
||||||
|
Height = 23
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 73
|
Width = 73
|
||||||
Height = 23
|
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'OK'
|
Caption = 'OK'
|
||||||
ModalResult = 1
|
ModalResult = 1
|
||||||
@@ -170,9 +166,9 @@ object OfficeMoreColorsWin: TOfficeMoreColorsWin
|
|||||||
end
|
end
|
||||||
object Cancelbtn: TButton
|
object Cancelbtn: TButton
|
||||||
Left = 242
|
Left = 242
|
||||||
|
Height = 23
|
||||||
Top = 36
|
Top = 36
|
||||||
Width = 73
|
Width = 73
|
||||||
Height = 23
|
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Cancel = True
|
Cancel = True
|
||||||
Caption = 'Cancel'
|
Caption = 'Cancel'
|
||||||
@@ -180,23 +176,23 @@ object OfficeMoreColorsWin: TOfficeMoreColorsWin
|
|||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object NewSwatch: TmbColorPreview
|
object NewSwatch: TmbColorPreview
|
||||||
Left = 246
|
Left = 242
|
||||||
Top = 238
|
|
||||||
Width = 68
|
|
||||||
Height = 32
|
Height = 32
|
||||||
Hint = 'RGB(255, 255, 255)'
|
Hint = 'RGB(255, 255, 255)'
|
||||||
Anchors = [akRight, akBottom]
|
Top = 92
|
||||||
|
Width = 68
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
OnColorChange = NewSwatchColorChange
|
OnColorChange = NewSwatchColorChange
|
||||||
end
|
end
|
||||||
object OldSwatch: TmbColorPreview
|
object OldSwatch: TmbColorPreview
|
||||||
Left = 246
|
Left = 242
|
||||||
Top = 269
|
|
||||||
Width = 68
|
|
||||||
Height = 32
|
Height = 32
|
||||||
Hint = 'RGB(255, 255, 255)'#13#10'Hex: FFFFFF'
|
Hint = 'RGB(255, 255, 255)'#13#10'Hex: FFFFFF'
|
||||||
Anchors = [akRight, akBottom]
|
Top = 123
|
||||||
|
Width = 68
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
OnColorChange = OldSwatchColorChange
|
OnColorChange = OldSwatchColorChange
|
||||||
|
@@ -27,9 +27,9 @@ type
|
|||||||
Label2: TLabel;
|
Label2: TLabel;
|
||||||
Label3: TLabel;
|
Label3: TLabel;
|
||||||
ColorModel: TComboBox;
|
ColorModel: TComboBox;
|
||||||
LRed: TLabel;
|
LRedOrHue: TLabel;
|
||||||
LGreen: TLabel;
|
LGreenOrSat: TLabel;
|
||||||
LBlue: TLabel;
|
LBlueOrLum: TLabel;
|
||||||
Label4: TLabel;
|
Label4: TLabel;
|
||||||
Label5: TLabel;
|
Label5: TLabel;
|
||||||
OKbtn: TButton;
|
OKbtn: TButton;
|
||||||
@@ -38,19 +38,26 @@ type
|
|||||||
OldSwatch: TmbColorPreview;
|
OldSwatch: TmbColorPreview;
|
||||||
procedure ColorModelChange(Sender: TObject);
|
procedure ColorModelChange(Sender: TObject);
|
||||||
procedure HSLChange(Sender: TObject);
|
procedure HSLChange(Sender: TObject);
|
||||||
procedure ERedChange(Sender: TObject);
|
procedure ERedOrHueChange(Sender: TObject);
|
||||||
procedure EGreenChange(Sender: TObject);
|
procedure EGreenOrSatChange(Sender: TObject);
|
||||||
procedure EBlueChange(Sender: TObject);
|
procedure EBlueOrLumChange(Sender: TObject);
|
||||||
procedure FormKeyDown(Sender: TObject; var Key: Word;
|
procedure FormCreate(Sender: TObject);
|
||||||
Shift: TShiftState);
|
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
procedure FormResize(Sender: TObject);
|
||||||
|
function GetHint(c: TColor): string;
|
||||||
procedure HexaChange(Sender: TObject);
|
procedure HexaChange(Sender: TObject);
|
||||||
procedure NewSwatchColorChange(Sender: TObject);
|
procedure NewSwatchColorChange(Sender: TObject);
|
||||||
procedure OldSwatchColorChange(Sender: TObject);
|
procedure OldSwatchColorChange(Sender: TObject);
|
||||||
function GetHint(c: TColor): string;
|
|
||||||
procedure SetAllToSel(c: TColor);
|
|
||||||
procedure PagesChange(Sender: TObject);
|
procedure PagesChange(Sender: TObject);
|
||||||
procedure FormResize(Sender: TObject);
|
procedure SetAllToSel(c: TColor);
|
||||||
procedure FormCreate(Sender: TObject);
|
private
|
||||||
|
{$IFDEF mbXP_Lib}
|
||||||
|
ERedOrHue, EGreenOrSat, EBlueOrLum: TmbXPSpinEdit;
|
||||||
|
grip: TmbXPSizeGrip;
|
||||||
|
{$ELSE}
|
||||||
|
ERedOrHue, EGreenOrSat, EBlueOrLum: TSpinEdit;
|
||||||
|
{$ENDIF}
|
||||||
|
FLockChange: Integer;
|
||||||
protected
|
protected
|
||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
procedure CreateWnd; override;
|
procedure CreateWnd; override;
|
||||||
@@ -58,13 +65,6 @@ type
|
|||||||
|
|
||||||
var
|
var
|
||||||
OfficeMoreColorsWin: TOfficeMoreColorsWin;
|
OfficeMoreColorsWin: TOfficeMoreColorsWin;
|
||||||
h, s, l: integer;
|
|
||||||
{$IFDEF mbXP_Lib}
|
|
||||||
ERed, EGreen, EBlue: TmbXPSpinEdit;
|
|
||||||
grip: TmbXPSizeGrip;
|
|
||||||
{$ELSE}
|
|
||||||
ERed, EGreen, EBlue: TSpinEdit;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -89,32 +89,34 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.ColorModelChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.ColorModelChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
h, s, l: Integer;
|
||||||
begin
|
begin
|
||||||
case ColorModel.ItemIndex of
|
case ColorModel.ItemIndex of
|
||||||
0:
|
0:
|
||||||
begin
|
begin
|
||||||
LRed.Caption := '&Red:';
|
LRedOrHue.Caption := '&Red:';
|
||||||
LGreen.Caption := '&Green:';
|
LGreenOrSat.Caption := '&Green:';
|
||||||
LBlue.Caption := '&Blue:';
|
LBlueOrLum.Caption := '&Blue:';
|
||||||
ERed.MaxValue := 255;
|
ERedOrHue.MaxValue := 255;
|
||||||
EGreen.MaxValue := 255;
|
EGreenOrSat.MaxValue := 255;
|
||||||
EBlue.MaxValue := 255;
|
EBlueOrLum.MaxValue := 255;
|
||||||
ERed.Value := GetRValue(NewSwatch.Color);
|
ERedOrHue.Value := GetRValue(NewSwatch.Color);
|
||||||
EGreen.Value := GetGValue(NewSwatch.Color);
|
EGreenOrSat.Value := GetGValue(NewSwatch.Color);
|
||||||
EBlue.Value := GetBValue(NewSwatch.Color);
|
EBlueOrLum.Value := GetBValue(NewSwatch.Color);
|
||||||
end;
|
end;
|
||||||
1:
|
1:
|
||||||
begin
|
begin
|
||||||
LRed.Caption := 'H&ue:';
|
LRedOrHue.Caption := 'H&ue:';
|
||||||
LGreen.Caption := '&Sat:';
|
LGreenOrSat.Caption := '&Sat:';
|
||||||
LBlue.Caption := '&Lum:';
|
LBlueOrLum.Caption := '&Lum:';
|
||||||
ERed.MaxValue := 238;
|
ERedOrHue.MaxValue := MaxHue; //238;
|
||||||
EGreen.MaxValue := 240;
|
EGreenOrSat.MaxValue := MaxSat; //240;
|
||||||
EBlue.MaxValue := 240;
|
EBlueOrLum.MaxValue := MaxLum; //240;
|
||||||
RGBtoHSLRange(NewSwatch.Color, h, s, l);
|
RGBtoHSLRange(NewSwatch.Color, h, s, l);
|
||||||
ERed.Value := h;
|
ERedOrHue.Value := h;
|
||||||
EGreen.Value := s;
|
EGreenOrSat.Value := s;
|
||||||
EBlue.Value := l;
|
EBlueOrLum.Value := l;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -125,70 +127,77 @@ begin
|
|||||||
case ColorModel.ItemIndex of
|
case ColorModel.ItemIndex of
|
||||||
0:
|
0:
|
||||||
begin
|
begin
|
||||||
ERed.Value := HSL.RValue;
|
ERedOrHue.Value := HSL.RValue;
|
||||||
EGreen.Value := HSL.GValue;
|
EGreenOrSat.Value := HSL.GValue;
|
||||||
EBlue.Value := HSL.BValue;
|
EBlueOrLum.Value := HSL.BValue;
|
||||||
NewSwatch.Color := HSL.SelectedColor;
|
NewSwatch.Color := HSL.SelectedColor;
|
||||||
end;
|
end;
|
||||||
1:
|
1:
|
||||||
begin
|
begin
|
||||||
ERed.Value := HSL.HValue;
|
ERedOrHue.Value := HSL.HValue;
|
||||||
EGreen.Value := HSL.SValue;
|
EGreenOrSat.Value := HSL.SValue;
|
||||||
EBlue.Value := HSL.LValue;
|
EBlueOrLum.Value := HSL.LValue;
|
||||||
NewSwatch.Color := HSL.SelectedColor;
|
NewSwatch.Color := HSL.SelectedColor;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.ERedChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.ERedOrHueChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (ERed.Text <> '') and
|
inc(FLockChange);
|
||||||
(ERed.Focused {$IFDEF DELPHI} or ERed.Button.Focused{$ENDIF})
|
if (ERedOrHue.Text <> '') and
|
||||||
|
(ERedOrHue.Focused {$IFDEF DELPHI} or ERedOrHue.Button.Focused{$ENDIF})
|
||||||
then
|
then
|
||||||
case ColorModel.ItemIndex of
|
case ColorModel.ItemIndex of
|
||||||
0: begin
|
0: begin
|
||||||
HSL.RValue := ERed.Value;
|
HSL.RValue := ERedOrHue.Value;
|
||||||
NewSwatch.Color := RGB(ERed.Value, EGreen.Value, EBlue.Value);
|
NewSwatch.Color := RGB(ERedOrHue.Value, EGreenOrSat.Value, EBlueOrLum.Value);
|
||||||
end;
|
end;
|
||||||
1: begin
|
1: begin
|
||||||
HSL.HValue := ERed.Value;
|
HSL.HValue := ERedOrHue.Value;
|
||||||
NewSwatch.Color := HSLRangeToRGB(ERed.Value, EGreen.Value, EBlue.Value);
|
NewSwatch.Color := HSLRangeToRGB(ERedOrHue.Value, EGreenOrSat.Value, EBlueOrLum.Value);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
dec(FLockChange);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.EGreenChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.EGreenOrSatChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (EGreen.Text <> '') and
|
inc(FLockChange);
|
||||||
(EGreen.Focused {$IFDEF DELPHI}or EGreen.Button.Focused{$ENDIF})
|
NewSwatch.OnColorChange := nil;
|
||||||
|
if (EGreenOrSat.Text <> '') and
|
||||||
|
(EGreenOrSat.Focused {$IFDEF DELPHI}or EGreen.ButtonOrSat.Focused{$ENDIF})
|
||||||
then
|
then
|
||||||
case ColorModel.ItemIndex of
|
case ColorModel.ItemIndex of
|
||||||
0: begin
|
0: begin
|
||||||
HSL.GValue := EGreen.Value;
|
HSL.GValue := EGreenOrSat.Value;
|
||||||
NewSwatch.Color := RGB(ERed.Value, EGreen.Value, EBlue.Value);
|
NewSwatch.Color := RGB(ERedOrHue.Value, EGreenOrSat.Value, EBlueOrLum.Value);
|
||||||
end;
|
end;
|
||||||
1: begin
|
1: begin
|
||||||
HSL.SValue := EGreen.Value;
|
HSL.SValue := EGreenOrSat.Value;
|
||||||
NewSwatch.Color := HSLRangeToRGB(ERed.Value, EGreen.Value, EBlue.Value);
|
NewSwatch.Color := HSLRangeToRGB(ERedOrHue.Value, EGreenOrSat.Value, EBlueOrLum.Value);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
dec(FLockChange);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.EBlueChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.EBlueOrLumChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (EBlue.Text <> '') and
|
inc(FLockChange);
|
||||||
(EBlue.Focused {$IFDEF DELPHI} or EBlue.Button.Focused{$ENDIF})
|
if (EBlueOrLum.Text <> '') and
|
||||||
|
(EBlueOrLum.Focused {$IFDEF DELPHI} or EBlueOrLum.Button.Focused{$ENDIF})
|
||||||
then
|
then
|
||||||
case ColorModel.ItemIndex of
|
case ColorModel.ItemIndex of
|
||||||
0: begin
|
0: begin
|
||||||
HSL.BValue := EBlue.Value;
|
HSL.BValue := EBlueOrLum.Value;
|
||||||
NewSwatch.Color := RGB(ERed.Value, EGreen.Value, EBlue.Value);
|
NewSwatch.Color := RGB(ERedOrHue.Value, EGreenOrSat.Value, EBlueOrLum.Value);
|
||||||
end;
|
end;
|
||||||
1: begin
|
1: begin
|
||||||
HSL.LValue := EBlue.Value;
|
HSL.LValue := EBlueOrLum.Value;
|
||||||
NewSwatch.Color := HSLRangeToRGB(ERed.Value, EGreen.Value, EBlue.Value);
|
NewSwatch.Color := HSLRangeToRGB(ERedOrHue.Value, EGreenOrSat.Value, EBlueOrLum.Value);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
dec(FLockChange);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.FormKeyDown(Sender: TObject; var Key: Word;
|
procedure TOfficeMoreColorsWin.FormKeyDown(Sender: TObject; var Key: Word;
|
||||||
@@ -202,17 +211,38 @@ end;
|
|||||||
|
|
||||||
procedure TOfficeMoreColorsWin.HexaChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.HexaChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
NewSwatch.Color := Hexa.SelectedColor;
|
NewSwatch.Color := Hexa.SelectedColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOfficeMoreColorsWin.GetHint(c: TColor): string;
|
function TOfficeMoreColorsWin.GetHint(c: TColor): string;
|
||||||
begin
|
begin
|
||||||
Result := Format('RGB(%u, %u, %u)'#13'Hex: %s', [GetRValue(c), GetGValue(c), GetBValue(c), ColorToHex(c)]);
|
Result := Format('RGB(%u, %u, %u)'#13'Hex: %s', [
|
||||||
|
GetRValue(c), GetGValue(c), GetBValue(c), ColorToHex(c)
|
||||||
|
]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.NewSwatchColorChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.NewSwatchColorChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
r,g,b: Integer;
|
||||||
|
h,s,l: Integer;
|
||||||
begin
|
begin
|
||||||
NewSwatch.Hint := GetHint(NewSwatch.Color);
|
NewSwatch.Hint := GetHint(NewSwatch.Color);
|
||||||
|
if (ERedOrHue = nil) or (EBlueOrLum = nil) or (EGreenOrSat = nil) or
|
||||||
|
(FLockChange <> 0)
|
||||||
|
then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
if ColorModel.ItemIndex = 0 then // RGB
|
||||||
|
begin
|
||||||
|
ERedOrHue.Value := GetRValue(NewSwatch.Color);
|
||||||
|
EGreenOrSat.Value := GetGValue(NewSwatch.Color);
|
||||||
|
EBlueOrLum.Value := GetBValue(NewSwatch.Color);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
ERedOrHue.Value := GetHValue(NewSwatch.Color);
|
||||||
|
EGreenOrSat.Value := GetSValue(NewSwatch.Color);
|
||||||
|
EBlueOrLum.Value := GetLValue(NewSwatch.Color);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.OldSwatchColorChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.OldSwatchColorChange(Sender: TObject);
|
||||||
@@ -222,6 +252,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.SetAllToSel(c: TColor);
|
procedure TOfficeMoreColorsWin.SetAllToSel(c: TColor);
|
||||||
|
var
|
||||||
|
h, s, l: Integer;
|
||||||
begin
|
begin
|
||||||
case Pages.ActivePageIndex of
|
case Pages.ActivePageIndex of
|
||||||
// Standard Page
|
// Standard Page
|
||||||
@@ -233,16 +265,16 @@ begin
|
|||||||
case ColorModel.ItemIndex of
|
case ColorModel.ItemIndex of
|
||||||
0:
|
0:
|
||||||
begin
|
begin
|
||||||
ERed.Value := GetRValue(c);
|
ERedOrHue.Value := GetRValue(c);
|
||||||
EGreen.Value := GetGValue(c);
|
EGreenOrSat.Value := GetGValue(c);
|
||||||
EBlue.Value := GetBValue(c);
|
EBlueOrLum.Value := GetBValue(c);
|
||||||
end;
|
end;
|
||||||
1:
|
1:
|
||||||
begin
|
begin
|
||||||
RGBtoHSLRange(c, h, s, l);
|
RGBtoHSLRange(c, h, s, l);
|
||||||
ERed.Value := h;
|
ERedOrHue.Value := h;
|
||||||
EGreen.Value := s;
|
EGreenOrSat.Value := s;
|
||||||
EBlue.Value := l;
|
EBlueOrLum.Value := l;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -252,79 +284,73 @@ end;
|
|||||||
|
|
||||||
procedure TOfficeMoreColorsWin.PagesChange(Sender: TObject);
|
procedure TOfficeMoreColorsWin.PagesChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SetAllToSel(NewSwatch.Color);
|
SetAllToSel(NewSwatch.Color);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.FormResize(Sender: TObject);
|
procedure TOfficeMoreColorsWin.FormResize(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
{$IFDEF mbXP_Lib}
|
{$IFDEF mbXP_Lib}
|
||||||
grip.Left := ClientWidth - 15;
|
grip.Left := ClientWidth - 15;
|
||||||
grip.Top := ClientHeight - 15;
|
grip.Top := ClientHeight - 15;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOfficeMoreColorsWin.FormCreate(Sender: TObject);
|
procedure TOfficeMoreColorsWin.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
{$IFDEF mbXP_Lib}
|
{$IFDEF mbXP_Lib}
|
||||||
ERed := TmbXPSpinEdit.CreateParented(Custom.Handle);
|
ERedOrHue := TmbXPSpinEdit.CreateParented(Custom.Handle);
|
||||||
EGreen := TmbXPSpinEdit.CreateParented(Custom.Handle);
|
EGreenOrSat := TmbXPSpinEdit.CreateParented(Custom.Handle);
|
||||||
EBlue := TmbXPSpinEdit.CreateParented(Custom.Handle);
|
EBlueOrLum := TmbXPSpinEdit.CreateParented(Custom.Handle);
|
||||||
grip := TmbXPSizeGrip.CreateParented(Self.Handle);
|
grip := TmbXPSizeGrip.CreateParented(Self.Handle);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
ERed := TSpinEdit.CreateParented(Custom.Handle);
|
ERedOrHue := TSpinEdit.CreateParented(Custom.Handle);
|
||||||
EGreen := TSpinEdit.CreateParented(Custom.Handle);
|
EGreenOrSat := TSpinEdit.CreateParented(Custom.Handle);
|
||||||
EBlue := TSpinEdit.CreateParented(Custom.Handle);
|
EBlueOrLum := TSpinEdit.CreateParented(Custom.Handle);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
with ERed do
|
with ERedOrHue do
|
||||||
begin
|
begin
|
||||||
Name := 'ERed';
|
Name := 'ERed';
|
||||||
Width := 47;
|
Width := 47;
|
||||||
Height := 22;
|
Height := 22;
|
||||||
Left := 74;
|
Left := 74;
|
||||||
Top := 198;
|
Top := LRedOrHue.Top - 4; //198;
|
||||||
Anchors := [akLeft, akBottom];
|
Anchors := [akLeft, akBottom];
|
||||||
MaxValue := 255;
|
MaxValue := 255;
|
||||||
MinValue := 0;
|
MinValue := 0;
|
||||||
Value := 0;
|
Value := 0;
|
||||||
{ to do
|
OnChange := @ERedOrHueChange;
|
||||||
OnChange := ERedChange;
|
|
||||||
}
|
|
||||||
end;
|
end;
|
||||||
with EGreen do
|
with EGreenOrSat do
|
||||||
begin
|
begin
|
||||||
Name := 'EGreen';
|
Name := 'EGreen';
|
||||||
Width := 47;
|
Width := 47;
|
||||||
Height := 22;
|
Height := 22;
|
||||||
Left := 74;
|
Left := 74;
|
||||||
Top := 224;
|
Top := LGreenOrSat.Top - 3; //224;
|
||||||
Anchors := [akLeft, akBottom];
|
Anchors := [akLeft, akBottom];
|
||||||
MaxValue := 255;
|
MaxValue := 255;
|
||||||
MinValue := 0;
|
MinValue := 0;
|
||||||
Value := 0;
|
Value := 0;
|
||||||
{ to do
|
OnChange := @EGreenOrSatChange;
|
||||||
OnChange := EGreenChange;
|
|
||||||
}
|
|
||||||
end;
|
end;
|
||||||
with EBlue do
|
with EBlueOrLum do
|
||||||
begin
|
begin
|
||||||
Name := 'EBlue';
|
Name := 'EBlue';
|
||||||
Width := 47;
|
Width := 47;
|
||||||
Height := 22;
|
Height := 22;
|
||||||
Left := 74;
|
Left := 74;
|
||||||
Top := 251;
|
Top := LBlueOrLum.Top - 4; //251;
|
||||||
Anchors := [akLeft, akBottom];
|
Anchors := [akLeft, akBottom];
|
||||||
MaxValue := 255;
|
MaxValue := 255;
|
||||||
MinValue := 0;
|
MinValue := 0;
|
||||||
Value := 0;
|
Value := 0;
|
||||||
{ to do
|
OnChange := @EBlueOrLumChange;
|
||||||
OnChange := EBlueChange;
|
|
||||||
}
|
|
||||||
end;
|
end;
|
||||||
Custom.InsertControl(ERed);
|
Custom.InsertControl(ERedOrHue);
|
||||||
Custom.InsertControl(EGreen);
|
Custom.InsertControl(EGreenOrSat);
|
||||||
Custom.InsertControl(EBlue);
|
Custom.InsertControl(EBlueOrLum);
|
||||||
{$IFDEF mbXP_Lib}
|
{$IFDEF mbXP_Lib}
|
||||||
with grip do
|
with grip do
|
||||||
begin
|
begin
|
||||||
Name := 'grip';
|
Name := 'grip';
|
||||||
Width := 15;
|
Width := 15;
|
||||||
|
@@ -15,9 +15,9 @@ uses
|
|||||||
Graphics, Math, Scanlines;
|
Graphics, Math, Scanlines;
|
||||||
|
|
||||||
var //set these variables to your needs, e.g. 360, 255, 255
|
var //set these variables to your needs, e.g. 360, 255, 255
|
||||||
MaxHue: integer = 239;
|
MaxHue: integer = 359; //239;
|
||||||
MaxSat: integer = 240;
|
MaxSat: integer = 100; //240;
|
||||||
MaxLum: integer = 240;
|
MaxLum: integer = 100; //240;
|
||||||
|
|
||||||
function HSLtoRGB (H, S, L: double): TColor;
|
function HSLtoRGB (H, S, L: double): TColor;
|
||||||
function HSLRangeToRGB (H, S, L: integer): TColor;
|
function HSLRangeToRGB (H, S, L: integer): TColor;
|
||||||
|
@@ -56,7 +56,7 @@ object Form1: TForm1
|
|||||||
Height = 287
|
Height = 287
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 377
|
Width = 377
|
||||||
SelectedColor = 422918
|
SelectedColor = 488198
|
||||||
HSPickerHintFormat = 'H: %h S: %s'#13'Hex: %hex'
|
HSPickerHintFormat = 'H: %h S: %s'#13'Hex: %hex'
|
||||||
LPickerHintFormat = 'Luminance: %l'
|
LPickerHintFormat = 'Luminance: %l'
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
Reference in New Issue
Block a user