diff --git a/components/mbColorLib/HSVColorPicker.pas b/components/mbColorLib/HSCirclePicker.pas similarity index 87% rename from components/mbColorLib/HSVColorPicker.pas rename to components/mbColorLib/HSCirclePicker.pas index 1f463e42c..fd759c466 100644 --- a/components/mbColorLib/HSVColorPicker.pas +++ b/components/mbColorLib/HSCirclePicker.pas @@ -1,4 +1,4 @@ -unit HSVColorPicker; +unit HSCirclePicker; {$IFDEF FPC} {$MODE DELPHI} @@ -11,7 +11,7 @@ uses HTMLColors, mbColorConv, mbColorPickerControl; type - THSVColorPicker = class(TmbHSLVColorPickerControl) + THSCirclePicker = class(TmbHSLVColorPickerControl) private FSatCircColor, FHueLineColor: TColor; FShowSatCirc: boolean; @@ -64,9 +64,9 @@ implementation uses mbUtils; -{ THSVColorPicker } +{ THSCirclePicker } -constructor THSVColorPicker.Create(AOwner: TComponent); +constructor THSCirclePicker.Create(AOwner: TComponent); begin inherited; SetInitialBounds(0, 0, 204, 204); @@ -84,21 +84,21 @@ begin MarkerStyle := msCrossCirc; end; -procedure THSVColorPicker.CreateGradient; +procedure THSCirclePicker.CreateGradient; begin FGradientWidth := Min(Width, Height); FGradientHeight := FGradientWidth; inherited; end; (* -procedure THSVColorPicker.CreateWnd; +procedure THSCirclePicker.CreateWnd; begin inherited; CreateGradient; UpdateCoords; end; *) -procedure THSVColorPicker.DrawSatCirc; +procedure THSCirclePicker.DrawSatCirc; var delta: integer; radius: integer; @@ -115,7 +115,7 @@ begin end; end; -procedure THSVColorPicker.DrawHueLine; +procedure THSCirclePicker.DrawHueLine; var angle: double; sinAngle, cosAngle: Double; @@ -134,7 +134,7 @@ begin end; end; -procedure THSVColorPicker.DrawMarker(x, y: integer); +procedure THSCirclePicker.DrawMarker(x, y: integer); var c: TColor; begin @@ -147,7 +147,7 @@ begin InternalDrawMarker(x, y, c); end; -function THSVColorPicker.GetColorAtPoint(x, y: integer): TColor; +function THSCirclePicker.GetColorAtPoint(x, y: integer): TColor; var angle: Double; dx, dy, r, radius: integer; @@ -175,7 +175,7 @@ begin end; { Outer loop: Y, Inner loop: X } -function THSVColorPicker.GetGradientColor2D(X, Y: Integer): TColor; +function THSCirclePicker.GetGradientColor2D(X, Y: Integer): TColor; var dx, dy: Integer; dSq, radiusSq: Integer; @@ -204,7 +204,7 @@ begin Result := GetDefaultColor(dctBrush); end; -procedure THSVColorPicker.Paint; +procedure THSCirclePicker.Paint; var rgn: HRGN; R: TRect; @@ -223,14 +223,14 @@ begin DrawMarker(mx, my); end; -procedure THSVColorPicker.Resize; +procedure THSCirclePicker.Resize; begin inherited; CreateGradient; UpdateCoords; end; -procedure THSVColorPicker.SelectColor(x, y: integer); +procedure THSCirclePicker.SelectColor(x, y: integer); var angle: Double; dx, dy, r, radius: integer; @@ -273,7 +273,7 @@ begin DoChange; end; -procedure THSVColorPicker.SetHueLineColor(c: TColor); +procedure THSCirclePicker.SetHueLineColor(c: TColor); begin if FHueLineColor <> c then begin @@ -282,7 +282,7 @@ begin end; end; -procedure THSVColorPicker.SetRelHue(H: Double); +procedure THSCirclePicker.SetRelHue(H: Double); begin if H > 1 then H := H - 1; if H < 0 then H := H + 1; @@ -296,7 +296,7 @@ begin end; end; -procedure THSVColorPicker.SetRelSat(S: Double); +procedure THSCirclePicker.SetRelSat(S: Double); begin Clamp(S, 0.0, 1.0); if FSat <> S then @@ -309,7 +309,7 @@ begin end; end; -procedure THSVColorPicker.SetSatCircColor(c: TColor); +procedure THSCirclePicker.SetSatCircColor(c: TColor); begin if FSatCircColor <> c then begin @@ -318,7 +318,7 @@ begin end; end; -procedure THSVColorPicker.SetSelectedColor(c: TColor); +procedure THSCirclePicker.SetSelectedColor(c: TColor); begin if WebSafe then c := GetWebSafe(c); @@ -331,7 +331,7 @@ begin DoChange; end; -procedure THSVColorPicker.SetShowHueLine(s: boolean); +procedure THSCirclePicker.SetShowHueLine(s: boolean); begin if FShowHueLine <> s then begin @@ -340,7 +340,7 @@ begin end; end; -procedure THSVColorPicker.SetShowSatCirc(s: boolean); +procedure THSCirclePicker.SetShowSatCirc(s: boolean); begin if FShowSatCirc <> s then begin @@ -349,7 +349,7 @@ begin end; end; -procedure THSVColorPicker.SetShowSelCirc(s: boolean); +procedure THSCirclePicker.SetShowSelCirc(s: boolean); begin if FShowSelCirc <> s then begin @@ -358,7 +358,7 @@ begin end; end; -procedure THSVColorPicker.UpdateCoords; +procedure THSCirclePicker.UpdateCoords; var r, angle: double; sinAngle, cosAngle: Double; diff --git a/components/mbColorLib/SLHColorPicker.pas b/components/mbColorLib/SLHColorPicker.pas index 834d9c486..ed1f48ba3 100644 --- a/components/mbColorLib/SLHColorPicker.pas +++ b/components/mbColorLib/SLHColorPicker.pas @@ -130,7 +130,7 @@ begin FHCursor := crDefault; FSLCursor := crDefault; FHHint := 'Hue: %h'; - FSLHint := 'S: %hslS L: %l'#13'Hex: %hex'; + FSLHint := 'S: %s L: %l'#13'Hex: %hex'; // Saturation-Lightness picker FSLPicker := TSLColorPicker.Create(Self); diff --git a/components/mbColorLib/examples/fulldemo/main.lfm b/components/mbColorLib/examples/fulldemo/main.lfm index 8ba17f15a..591278457 100644 --- a/components/mbColorLib/examples/fulldemo/main.lfm +++ b/components/mbColorLib/examples/fulldemo/main.lfm @@ -624,11 +624,11 @@ object Form1: TForm1 end end object TabSheet5: TTabSheet - Caption = 'HSVColorPicker' + Caption = 'HSCirclePicker' ClientHeight = 376 ClientWidth = 468 ImageIndex = 4 - object HSVColorPicker1: THSVColorPicker + object HSCirclePicker1: THSCirclePicker Left = 24 Height = 362 Top = 6 diff --git a/components/mbColorLib/examples/fulldemo/main.pas b/components/mbColorLib/examples/fulldemo/main.pas index 676b6e6fe..0b6c08ddd 100644 --- a/components/mbColorLib/examples/fulldemo/main.pas +++ b/components/mbColorLib/examples/fulldemo/main.pas @@ -6,7 +6,7 @@ interface uses LCLIntf, LCLType, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, HSLColorPicker, ComCtrls, StdCtrls, ExtCtrls, mbColorPreview, - HexaColorPicker, mbColorPalette, HSLRingPicker, HSVColorPicker, PalUtils, + HexaColorPicker, mbColorPalette, HSLRingPicker, HSCirclePicker, PalUtils, SLHColorPicker, mbDeskPickerButton, mbOfficeColorDialog, SColorPicker, HColorPicker, LVColorPicker, mbTrackBarPicker, HRingPicker, SLColorPicker, HSColorPicker, IniFiles, mbColorPickerControl, BColorPicker, GColorPicker, @@ -50,7 +50,7 @@ type HSLRingPicker1: THSLRingPicker; TabSheet5: TTabSheet; TabSheet6: TTabSheet; - HSVColorPicker1: THSVColorPicker; + HSCirclePicker1: THSCirclePicker; SLHColorPicker1: TSLHColorPicker; TabSheet7: TTabSheet; TabSheet8: TTabSheet; @@ -244,8 +244,8 @@ end; procedure TForm1.HSVColorPicker1Change(Sender: TObject); begin - LVColorPicker1.Saturation := HSVColorPicker1.Saturation; - LVColorPicker1.Hue := HSVColorPicker1.Hue; + LVColorPicker1.Saturation := HSCirclePicker1.Saturation; + LVColorPicker1.Hue := HSCirclePicker1.Hue; sc.color := LVColorPicker1.SelectedColor; end; @@ -318,12 +318,12 @@ end; procedure TForm1.LVColorPicker1Change(Sender: TObject); begin - if (sc = nil) or (uc = nil) or (LVColorPicker1 = nil) or (HSVColorPicker1 = nil) then + if (sc = nil) or (uc = nil) or (LVColorPicker1 = nil) or (HSCirclePicker1 = nil) then exit; - LVColorPicker1.Saturation := HSVColorPicker1.Saturation; - LVColorPicker1.Hue := HSVColorPicker1.Hue; + LVColorPicker1.Saturation := HSCirclePicker1.Saturation; + LVColorPicker1.Hue := HSCirclePicker1.Hue; sc.Color := LVColorPicker1.SelectedColor; - uc.Color := HSVtoColor(HSVColorPicker1.RelHue, HSVColorPicker1.RelSaturation, HSVColorPicker1.RelValue); + uc.Color := HSVtoColor(HSCirclePicker1.RelHue, HSCirclePicker1.RelSaturation, HSCirclePicker1.RelValue); end; // only for internet shortcuts @@ -424,7 +424,7 @@ begin HSLRingPicker1.Enabled := CbEnabled.Checked else if PageControl1.ActivePage = Tabsheet5 then begin - HSVColorPicker1.Enabled := CbEnabled.Checked; + HSCirclePicker1.Enabled := CbEnabled.Checked; LVColorPicker1.Enabled := CbEnabled.Checked; end else if PageControl1.ActivePage = Tabsheet6 then diff --git a/components/mbColorLib/mbReg.lrs b/components/mbColorLib/mbReg.lrs index 73158f5b5..0d4ac7f02 100644 --- a/components/mbColorLib/mbReg.lrs +++ b/components/mbColorLib/mbReg.lrs @@ -359,43 +359,6 @@ LazarusResources.Add('THSLRingPicker','PNG',[ +'fsx'#243'I'#132'_'#222#254#1#178#190'J'#1#137#1#236#23#0#0#0#0'IEND'#174'B`' +#130 ]); -LazarusResources.Add('THSVColorPicker','PNG',[ - #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0 - +#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#3#10'IDATH'#199#237#213 - +'K'#139#28'U'#24#135#241#223#169#174#174#190'U'#247'\23'#153#196#4'Ds'#129'H' - +#196#184#18#220#138'K?'#129#11#23#174'D'#252#6#174'u-'#238#252#22'~'#7#193 - +#149#10'FA&'#184#136#8'c'#152'L'#166#167'oU'#221'Uu\t'#2#145'Lb'#162'+'#193 - +#23#254#20#156'*'#158#135'S'#231#173'z'#249#175'Wx'#158#135'>'#188#127'#'#142 - +#182#167#246#31'_'#147#129#237'p'#231#153#140#244'Y7_'#137'{'#241#154'mA'#207 - +#208#200'Hb_'#176'c'#233#158#210#158#185#250#240#181#216#218#255')'#188#176 - +#224'z|;n'#137'r'#29'C}C'#153'\0@'#174'6R'#200#205'%'#249'X'#252#238'V'#12'o' - +'~'#31#158'[p#~'#16'w'#144'+'#12'D}='#185#174#161'D.'#26#168#228#10#233'j' - +#198#180'Cv,~'#253'F'#12#239#253#16#254'Vp-~'#26'w'#180'l'#170'm('#13'UzR'#3 - +']'#3#169#1#134#150#186#230#194#162#203#180#205#20#142#196'/n'#196#240#201 - +#207#225#169#130#203#241#171#184')'#24#137'6'#213#182#212'6'#172#228#26#3#29 - +#185#204'P4TH'#203#233'Cx'#194#180#226'tE'#245#135#248#241#245#24#190#252'%' - +#156')'#200']'#144#11'r'#209'H'#180'%'#218'V'#25#169#244'%r'#153#145#168#27 - +#23#194#188#187#134'O'#234'5'#252#180'`<'#163':<'#251#21#189'~x;'#182','#244 - +'$'#250#162#28'Cljl'#169#140'D'#185#182#190'FR'#206#152#165#15#225'%'''#5#227 - +#30''']'#198#221#179#5#199#231#183#189'$j'#11#218#200#208#195'@'#180')'#218 - +#22'mHdu'#193'$'#229#164#228'A'#151#227#140#251')G'#173'u'#238'%'#226#213#183 - +'b8'#248'6'#252'E'#16#236'H"!'#144#160#133'4'#210#14't"}'#244'$'#146#197')' - +#227#146#7#157'5'#252'8'#227'8'#229#232#177'$'#197#25#135'|'#191#189'&#>'#150 - +'&P7'#148'X!['#12#132#249#6#139#5'E'#193#178#160'|t-'#215'kfO'#10'~'#219#9'a' - +#255'v'#140'UB'#133'e'#164#8',"'#167'5'#237#134'~'#139'N'#147'iOF'#204#23#172 - +'J'#150'K'#170#138'jE'#189#162#169#132#131'o'#206#238#162#226#144'"YC'#231#13 - +#19'd'#13#150#180#19#242#140#188'!]'#244#132#241'h'#221'9'#211#130'E'#249'p' - +#23'%e'#253#244#15'mv'#200#28#179'H'#175'Y'#195#195#10'5'#253#14#211#140'IC' - +#167'h'#233'L'#6#156#140#152#20#235#204#22#204'K'#225#238'g!jb'#144#132''''#4 - +#191#190#31#194#224#243#24#179'@Z'#19'WTK'#210#22#155'='#166#233'Z'#208'[' - +#210#158'w$'#211#156#147'9'#227#5#147#197#186'e'#241#8#254#212#223#245#173 - +#143'b'#220'j'#24#149#156'k'#184#212']'#231'B'#139#243#13#187#21#187#5#189'i' - +')'#140#143'89'#226#232'H8x''<'#247'<'#184#249'n'#140'[5'#23'R.'#247#185#212 - +'a?'#176'g-'#216'+97'#163'5'#25's|$'#220#185#18'^x'#224#220#188#26#227#203'9' - +#151'{\L'#217'O8'#143#221#154#221#146#221#5#249#184#150#220'M'#195'?'#26'8?' - +#30#132'p'#229'b'#140#147#222#250#128#167#24#160'W'#145#205'y'#245#247#16#252 - +'_'#255#182#254#4'leR'#175#234#10''''#210#0#0#0#0'IEND'#174'B`'#130 -]); LazarusResources.Add('TKColorPicker','PNG',[ #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0 +#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0'{IDATH'#199#237#149#177 @@ -634,3 +597,40 @@ LazarusResources.Add('TLVColorPicker','PNG',[ +#170#238#228#14#248#19#0#245#151'y}'#192#3#148#140'h'#197#198'%'#238'5'#0#0#0 +#0'IEND'#174'B`'#130 ]); +LazarusResources.Add('THSCirclePicker','PNG',[ + #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0 + +#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#3#10'IDATH'#199#237#213 + +'K'#139#28'U'#24#135#241#223#169#174#174#190'U'#247'\23'#153#196#4'Ds'#129'H' + +#196#184#18#220#138'K?'#129#11#23#174'D'#252#6#174'u-'#238#252#22'~'#7#193 + +#149#10'FA&'#184#136#8'c'#152'L'#166#167'oU'#221'Uu\t'#2#145'Lb'#162'+'#193 + +#23#254#20#156'*'#158#135'S'#231#173'z'#249#175'Wx'#158#135'>'#188#127'#'#142 + +#182#167#246#31'_'#147#129#237'p'#231#153#140#244'Y7_'#137'{'#241#154'mA'#207 + +#208#200'Hb_'#176'c'#233#158#210#158#185#250#240#181#216#218#255')'#188#176 + +#224'z|;n'#137'r'#29'C}C'#153'\0@'#174'6R'#200#205'%'#249'X'#252#238'V'#12'o' + +'~'#31#158'[p#~'#16'w'#144'+'#12'D}='#185#174#161'D.'#26#168#228#10#233'j' + +#198#180'Cv,~'#253'F'#12#239#253#16#254'Vp-~'#26'w'#180'l'#170'm('#13'UzR'#3 + +']'#3#169#1#134#150#186#230#194#162#203#180#205#20#142#196'/n'#196#240#201 + +#207#225#169#130#203#241#171#184')'#24#137'6'#213#182#212'6'#172#228#26#3#29 + +#185#204'P4TH'#203#233'Cx'#194#180#226'tE'#245#135#248#241#245#24#190#252'%' + +#156')'#200']'#144#11'r'#209'H'#180'%'#218'V'#25#169#244'%r'#153#145#168#27 + +#23#194#188#187#134'O'#234'5'#252#180'`<'#163':<'#251#21#189'~x;'#182','#244 + +'$'#250#162#28'Cljl'#169#140'D'#185#182#190'FR'#206#152#165#15#225'%'''#5#227 + +#30''']'#198#221#179#5#199#231#183#189'$j'#11#218#200#208#195'@'#180')'#218 + +#22'mHdu'#193'$'#229#164#228'A'#151#227#140#251')G'#173'u'#238'%'#226#213#183 + +'b8'#248'6'#252'E'#16#236'H"!'#144#160#133'4'#210#14't"}'#244'$'#146#197')' + +#227#146#7#157'5'#252'8'#227'8'#229#232#177'$'#197#25#135'|'#191#189'&#>'#150 + +'&P7'#148'X!['#12#132#249#6#139#5'E'#193#178#160'|t-'#215'kfO'#10'~'#219#9'a' + +#255'v'#140'UB'#133'e'#164#8',"'#167'5'#237#134'~'#139'N'#147'iOF'#204#23#172 + +'J'#150'K'#170#138'jE'#189#162#169#132#131'o'#206#238#162#226#144'"YC'#231#13 + +#19'd'#13#150#180#19#242#140#188'!]'#244#132#241'h'#221'9'#211#130'E'#249'p' + +#23'%e'#253#244#15'mv'#200#28#179'H'#175'Y'#195#195#10'5'#253#14#211#140'IC' + +#167'h'#233'L'#6#156#140#152#20#235#204#22#204'K'#225#238'g!jb'#144#132''''#4 + +#191#190#31#194#224#243#24#179'@Z'#19'WTK'#210#22#155'='#166#233'Z'#208'[' + +#210#158'w$'#211#156#147'9'#227#5#147#197#186'e'#241#8#254#212#223#245#173 + +#143'b'#220'j'#24#149#156'k'#184#212']'#231'B'#139#243#13#187#21#187#5#189'i' + +')'#140#143'89'#226#232'H8x''<'#247'<'#184#249'n'#140'[5'#23'R.'#247#185#212 + +'a?'#176'g-'#216'+97'#163'5'#25's|$'#220#185#18'^x'#224#220#188#26#227#203'9' + +#151'{\L'#217'O8'#143#221#154#221#146#221#5#249#184#150#220'M'#195'?'#26'8?' + +#30#132'p'#229'b'#140#147#222#250#128#167#24#160'W'#145#205'y'#245#247#16#252 + +'_'#255#182#254#4'leR'#175#234#10''''#210#0#0#0#0'IEND'#174'B`'#130 +]); diff --git a/components/mbColorLib/mbReg.pas b/components/mbColorLib/mbReg.pas index 5cf25e3d5..77e61b323 100644 --- a/components/mbColorLib/mbReg.pas +++ b/components/mbColorLib/mbReg.pas @@ -20,7 +20,7 @@ uses CColorPicker, MColorPicker, YColorPicker, KColorPicker, HRingPicker, HColorPicker, SColorPicker, LVColorPicker, //LColorPicker, VColorPicker, - HSColorPicker, HSVColorPicker, HSLColorPicker, HSLRingPicker, + HSColorPicker, HSCirclePicker, HSLColorPicker, HSLRingPicker, SLColorPicker, SLHColorPicker, CIEAColorPicker, CIEBColorPicker, CIELColorPicker, HexaColorPicker, mbColorPreview, mbColorList, mbColorTree, mbColorPalette, @@ -33,9 +33,8 @@ begin TRColorPicker, TGColorPicker, TBColorPicker, TRAxisColorPicker, TGAxisColorPicker, TBAxisColorPicker, TCColorPicker, TMColorPicker, TYColorPicker, TKColorPicker, - THRingPicker, - THColorPicker, TSColorPicker, TLVColorPicker, //TLColorPicker, TVColorPicker, - THSColorPicker, THSVColorPicker, THSLColorPicker, THSLRingPicker, + THRingPicker, THColorPicker, TSColorPicker, TLVColorPicker, + THSColorPicker, THSCirclePicker, THSLColorPicker, THSLRingPicker, TSLColorPicker, TSLHColorPicker, TCIEAColorPicker, TCIEBColorPicker, TCIELColorPicker, THexaColorPicker, TmbColorPreview, TmbColorList, TmbColorTree, diff --git a/components/mbColorLib/mbcolorliblaz.lpk b/components/mbColorLib/mbcolorliblaz.lpk index aa9ff9ca3..e5b6acd0f 100644 --- a/components/mbColorLib/mbcolorliblaz.lpk +++ b/components/mbColorLib/mbcolorliblaz.lpk @@ -133,8 +133,8 @@ - - + +