diff --git a/applications/lazimageeditor/colorpalette.lrs b/applications/lazimageeditor/colorpalette.lrs new file mode 100644 index 000000000..b7bf25dd3 --- /dev/null +++ b/applications/lazimageeditor/colorpalette.lrs @@ -0,0 +1,14 @@ +LazarusResources.Add('tcolorpalette','XPM',[ + '/* XPM */'#10'static char *graphic[] = {'#10'"20 21 13 1",'#10'". c #848484"' + +','#10'", c None",'#10'"- c #FFFFFF",'#10'"* c #C6C6C6",'#10'"a c #000000",' + +#10'"b c #840000",'#10'"c c #848400",'#10'"d c #808000",'#10'"e c #FF0000",' + +#10'"f c #FFFF00",'#10'"g c #008400",'#10'"h c #008484",'#10'"i c #000084",' + +#10'"...................,",'#10'".-----------------*-",'#10'".-aaaaaaaaaaaaa' + +'aaa.-",'#10'".-aaaaaabbbbacccca.-",'#10'".-aaaaaabbbbacccca.-",'#10'".-aaaa' + +'aabbbbacccca.-",'#10'".-aaaaaabbbbaddcca.-",'#10'".-aaaaaaaaaaaaaaaa.-",'#10 + +'".-a----aeeeeaffffa.-",'#10'".-a----aeeeeaffffa.-",'#10'".-a----aeeeeaffffa' + +'.-",'#10'".-a----aeeeeaffffa.-",'#10'".-aaaaaaaaaaaaaaaa.-",'#10'".-aggggah' + +'hhhaiiiia.-",'#10'".-aggggahhhhaiiiia.-",'#10'".-aggggahhhhaiiiia.-",'#10'"' + +'.-aggggahhhhaiiiia.-",'#10'".-aaaaaaaaaaaaaaaa.-",'#10'".*.................' + +'-",'#10'",-------------------",'#10'",,,,,,,,,,,,,,,,,,,,"}'#10 +]); diff --git a/applications/lazimageeditor/colorpalette.pas b/applications/lazimageeditor/colorpalette.pas index 2735036ec..3bad4bf0d 100644 --- a/applications/lazimageeditor/colorpalette.pas +++ b/applications/lazimageeditor/colorpalette.pas @@ -73,9 +73,12 @@ type protected procedure MouseDown(Button: TMouseButton; 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 ColorPick(AColor: TColor; Shift: TShiftState); dynamic; procedure ColorMouseMove(AColor: TColor; Shift: TShiftState); dynamic; public + PickedColor: TColor; + PickShift: TShiftState; constructor Create(TheOwner: TComponent); override; destructor Destroy; override; procedure Paint; override; @@ -174,21 +177,31 @@ end; procedure TCustomColorPalette.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var - C: TColor; begin inherited; - + X := X div FButtonWidth; Y := Y div FButtonHeight; - + +// if X + Y * FCols < 0 then +// Exit; + if X + Y * FCols < FColors.Count then begin - C := TColor(FColors.Items[X + Y * FCols]); - if C <> clNone then ColorPick(C, Shift); + PickedColor := TColor(FColors.Items[X + Y * FCols]); + //if PickedColor <> clNone then ColorPick(PickedColor, Shift); + PickShift := Shift; end; end; +procedure TCustomColorPalette.MouseUp(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + if PickedColor <> clNone then + ColorPick(PickedColor, PickShift); + inherited; +end; + procedure TCustomColorPalette.MouseMove(Shift: TShiftState; X, Y: Integer); var C: TColor;