colorpalette: Activate LCL scaling of Laz 1.8. Replace .lrs resource by .res. Add highDPI component palette icons (see image_sources). Set version no 0.2.3.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5940 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-06-16 18:01:08 +00:00
parent 23a7f498e0
commit cc2abec65b
12 changed files with 54 additions and 34 deletions

View File

@ -1,14 +0,0 @@
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
]);

View File

@ -48,7 +48,7 @@ unit ColorPalette;
interface
uses
Classes, SysUtils, LResources, Controls, Forms, Graphics, Math,
Classes, SysUtils, LResources, LCLVersion, Controls, Forms, Graphics, Math,
LCLType;
type
@ -138,6 +138,10 @@ type
procedure ColorPick(AIndex: Integer; Shift: TShiftState); virtual;
procedure ColorMouseMove(AColor: TColor; Shift: TShiftState); virtual;
procedure DoAddColor(AColor: TColor; AColorName: String = ''); virtual;
{$IF LCL_FULLVERSION >= 1080000}
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
{$ENDIF}
procedure DoColorPick(AColor: TColor; AShift: TShiftState); virtual;
procedure DoDeleteColor(AIndex: Integer); virtual;
procedure DoInsertColor(AIndex: Integer; AColor: TColor; AColorName: String = ''); virtual;
@ -251,8 +255,10 @@ type
implementation
{$R colorpalette.res}
uses
LCLIntf, StrUtils;
LCLIntf;
const
SELKIND_NAMES: Array[TPaletteSelectionKind] of String = (
@ -363,6 +369,23 @@ begin
FColors.AddObject(AColorName, TObject(PtrInt(AColor)));
end;
{$IF LCL_FULLVERSION >= 1080000}
procedure TCustomColorPalette.DoAutoAdjustLayout(
const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double);
begin
inherited DoAutoAdjustLayout(AMode, AXProportion, AYProportion);
if AMode = lapAutoAdjustForDPI then
begin
FButtonWidth := Round(FButtonWidth * AXProportion);
FButtonHeight := Round(FButtonHeight * AYProportion);
FButtonDistance := Round(FButtonDistance * AXProportion);
UpdateSize;
Invalidate;
end;
end;
{$ENDIF}
procedure TCustomColorPalette.DoColorPick(AColor: TColor; AShift: TShiftState);
begin
if Assigned(FOnColorPick) then
@ -1318,8 +1341,5 @@ begin
end;
initialization
{$I colorpalette.lrs}
end.

Binary file not shown.

View File

@ -7,8 +7,12 @@
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="project1"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<i18n>

View File

@ -13,6 +13,7 @@ uses
{$R *.res}
begin
Application.Scaled := True;
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);

View File

@ -7,8 +7,9 @@ object MainForm: TMainForm
ClientHeight = 586
ClientWidth = 625
OnCreate = FormCreate
Position = poScreenCenter
ShowHint = True
LCLVersion = '1.5'
LCLVersion = '1.9.0.0'
object LeftPanel: TPanel
Left = 0
Height = 586
@ -439,11 +440,11 @@ object MainForm: TMainForm
Top = 8
Width = 287
HorzScrollBar.Increment = 15
HorzScrollBar.Page = 155
HorzScrollBar.Page = 154
HorzScrollBar.Smooth = True
HorzScrollBar.Tracking = True
VertScrollBar.Increment = 4
VertScrollBar.Page = 42
VertScrollBar.Page = 41
VertScrollBar.Smooth = True
VertScrollBar.Tracking = True
Anchors = [akTop, akLeft, akRight, akBottom]
@ -453,10 +454,10 @@ object MainForm: TMainForm
TabOrder = 2
object ColorPalette: TColorPalette
Left = 0
Height = 41
Height = 40
Hint = 'Click to select a color'
Top = 1
Width = 155
Width = 154
ButtonHeight = 20
ButtonWidth = 20
ColumnCount = 8

View File

@ -7,8 +7,12 @@
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="project1"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<i18n>

View File

@ -13,6 +13,7 @@ uses
{$R *.res}
begin
Application.Scaled := True;
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);

View File

@ -8,7 +8,7 @@ object MainForm: TMainForm
ClientWidth = 633
OnCreate = FormCreate
ShowHint = True
LCLVersion = '1.5'
LCLVersion = '1.9.0.0'
object MainPanel: TPanel
Left = 0
Height = 432
@ -110,10 +110,11 @@ object MainForm: TMainForm
AnchorSideLeft.Control = CoolBar
AnchorSideTop.Control = CoolBar
Left = 13
Height = 49
Height = 45
Top = 5
Width = 50
Width = 46
Align = alNone
AutoSize = True
BorderSpacing.Left = 11
BorderSpacing.Top = 3
ButtonHeight = 45
@ -141,7 +142,7 @@ object MainForm: TMainForm
AnchorSideLeft.Control = CoolBar
AnchorSideTop.Control = CoolBar
Left = 78
Height = 45
Height = 44
Top = 7
Width = 385
ButtonHeight = 15

View File

@ -20,16 +20,16 @@
</CompilerOptions>
<Description Value="This package contains a color palette component."/>
<License Value="Modified LGPL"/>
<Version Minor="2" Release="2"/>
<Version Minor="2" Release="3"/>
<Files Count="2">
<Item1>
<Filename Value="colorpalette.lrs"/>
<Type Value="LRS"/>
</Item1>
<Item2>
<Filename Value="colorpalette.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="ColorPalette"/>
</Item1>
<Item2>
<Filename Value="colorpalette.res"/>
<Type Value="Binary"/>
</Item2>
</Files>
<RequiredPkgs Count="2">
@ -48,5 +48,8 @@
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
<CustomOptions Items="ExternHelp" Version="2">
<_ExternHelp Items="Count"/>
</CustomOptions>
</Package>
</CONFIG>

View File

@ -4,7 +4,6 @@
unit LazColorPalette;
{$warn 5023 off : no warning about unused units}
interface
uses

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B