You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1579 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
14
applications/lazimageeditor/colorpalette.lrs
Normal file
14
applications/lazimageeditor/colorpalette.lrs
Normal file
@ -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
|
||||||
|
]);
|
@ -73,9 +73,12 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X, Y:Integer); override;
|
procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X, Y:Integer); override;
|
||||||
procedure MouseMove(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 ColorPick(AColor: TColor; Shift: TShiftState); dynamic;
|
||||||
procedure ColorMouseMove(AColor: TColor; Shift: TShiftState); dynamic;
|
procedure ColorMouseMove(AColor: TColor; Shift: TShiftState); dynamic;
|
||||||
public
|
public
|
||||||
|
PickedColor: TColor;
|
||||||
|
PickShift: TShiftState;
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
@ -174,21 +177,31 @@ end;
|
|||||||
|
|
||||||
procedure TCustomColorPalette.MouseDown(Button: TMouseButton;
|
procedure TCustomColorPalette.MouseDown(Button: TMouseButton;
|
||||||
Shift: TShiftState; X, Y: Integer);
|
Shift: TShiftState; X, Y: Integer);
|
||||||
var
|
|
||||||
C: TColor;
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
X := X div FButtonWidth;
|
X := X div FButtonWidth;
|
||||||
Y := Y div FButtonHeight;
|
Y := Y div FButtonHeight;
|
||||||
|
|
||||||
|
// if X + Y * FCols < 0 then
|
||||||
|
// Exit;
|
||||||
|
|
||||||
if X + Y * FCols < FColors.Count then
|
if X + Y * FCols < FColors.Count then
|
||||||
begin
|
begin
|
||||||
C := TColor(FColors.Items[X + Y * FCols]);
|
PickedColor := TColor(FColors.Items[X + Y * FCols]);
|
||||||
if C <> clNone then ColorPick(C, Shift);
|
//if PickedColor <> clNone then ColorPick(PickedColor, Shift);
|
||||||
|
PickShift := Shift;
|
||||||
end;
|
end;
|
||||||
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);
|
procedure TCustomColorPalette.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
var
|
var
|
||||||
C: TColor;
|
C: TColor;
|
||||||
|
Reference in New Issue
Block a user