jvcllaz: High-DPI palette icons for TAdvLED, TLEDNumber, TStopLighSensor. One more fix for TLEDNumber lcl scaling (still not perfect). one issue left).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7306 8e941d3f-bd1b-0410-a28a-d453659cc2b4
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 1.3 KiB |
BIN
components/industrialstuff/resources/black_150.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
components/industrialstuff/resources/black_200.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
components/industrialstuff/resources/bulbdisabled.png
Normal file
After Width: | Height: | Size: 678 B |
BIN
components/industrialstuff/resources/bulbdisabled_150.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
components/industrialstuff/resources/bulbdisabled_200.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
components/industrialstuff/resources/bulboff.png
Normal file
After Width: | Height: | Size: 465 B |
@ -1,34 +0,0 @@
|
||||
/* XPM */
|
||||
static char * LEDBULBOFF[] = {
|
||||
"15 15 16 1",
|
||||
" c #000000",
|
||||
". c #800000",
|
||||
"+ c #008000",
|
||||
"@ c #808000",
|
||||
"# c #000080",
|
||||
"$ c #800080",
|
||||
"% c #008080",
|
||||
"& c #808080",
|
||||
"* c #C0C0C0",
|
||||
"= c #FF0000",
|
||||
"- c #00FF00",
|
||||
"; c #FFFF00",
|
||||
"> c #0000FF",
|
||||
", c #FF00FF",
|
||||
"' c #00FFFF",
|
||||
") c #FFFFFF",
|
||||
"@@@@@@@@@@@@@@@",
|
||||
"@@@@@@@@@@@@@@@",
|
||||
"@@@@@@@@@@@@@@@",
|
||||
"@@@@@@@@@@@@@@@",
|
||||
"@@@@@@ @@@@@@",
|
||||
"@@@@@ ))) @@@@@",
|
||||
"@@@@ ))))) @@@@",
|
||||
"@@@@ ))&)) @@@@",
|
||||
"@@@@ ))&)) @@@@",
|
||||
"@@@@@ )&) @@@@@",
|
||||
"@@@@@@ ) @@@@@@",
|
||||
"@@@@@@ ) @@@@@@",
|
||||
"@@@@@@ @@@@@@",
|
||||
"@@@@@@ * @@@@@@",
|
||||
"@@@@@@ @@@@@@"};
|
BIN
components/industrialstuff/resources/bulboff_150.png
Normal file
After Width: | Height: | Size: 680 B |
BIN
components/industrialstuff/resources/bulboff_200.png
Normal file
After Width: | Height: | Size: 946 B |
BIN
components/industrialstuff/resources/bulbon.png
Normal file
After Width: | Height: | Size: 975 B |
@ -1,34 +0,0 @@
|
||||
/* XPM */
|
||||
static char * LEDBULBON[] = {
|
||||
"15 15 16 1",
|
||||
" c #000000",
|
||||
". c #800000",
|
||||
"+ c #008000",
|
||||
"@ c #808000",
|
||||
"# c #000080",
|
||||
"$ c #800080",
|
||||
"% c #008080",
|
||||
"& c #808080",
|
||||
"* c #C0C0C0",
|
||||
"= c #FF0000",
|
||||
"- c #00FF00",
|
||||
"; c #FFFF00",
|
||||
"> c #0000FF",
|
||||
", c #FF00FF",
|
||||
"' c #00FFFF",
|
||||
") c #FFFFFF",
|
||||
"@@@@@@@;@@@@@@@",
|
||||
"@@@@@@@;@@@@@@@",
|
||||
"@@;@@;;;;;@@;@@",
|
||||
"@@@;;;;;;;;;@@@",
|
||||
"@@@;;; ;;;@@@",
|
||||
"@@;;; );) ;;;@@",
|
||||
"@@;; ););) ;;@@",
|
||||
";;;; ;)&); ;;;;",
|
||||
"@@;; );&;) ;;@@",
|
||||
"@@;;; )&) ;;;@@",
|
||||
"@@@;;; ) ;;;@@@",
|
||||
"@@@;;; ; ;;;@@@",
|
||||
"@@;@@; ;@@;@@",
|
||||
"@@@@@@ * @@@@@@",
|
||||
"@@@@@@ @@@@@@"};
|
BIN
components/industrialstuff/resources/bulbon_150.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
components/industrialstuff/resources/bulbon_200.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
components/industrialstuff/resources/green_150.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
components/industrialstuff/resources/green_200.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
components/industrialstuff/resources/greenoff.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
components/industrialstuff/resources/greenoff_150.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
components/industrialstuff/resources/greenoff_200.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
@ -1,9 +1,15 @@
|
||||
tadvled.png
|
||||
tadvled_150.png
|
||||
tadvled_200.png
|
||||
tanalogsensor.png
|
||||
tindgnoumeter.png
|
||||
tindled.png
|
||||
tlednumber.png
|
||||
tlednumber_150.png
|
||||
tlednumber_200.png
|
||||
tstoplightsensor.png
|
||||
tstoplightsensor_150.png
|
||||
tstoplightsensor_200.png
|
||||
ta3naloggauge.png
|
||||
ta3naloggauge_150.png
|
||||
ta3naloggauge_200.png
|
||||
|
@ -1,6 +1,30 @@
|
||||
black.png
|
||||
black_150.png
|
||||
black_200.png
|
||||
green.png
|
||||
green_150.png
|
||||
green_200.png
|
||||
red.png
|
||||
red_150.png
|
||||
red_200.png
|
||||
yellow.png
|
||||
bulboff.xpm
|
||||
bulbon.xpm
|
||||
yellow_150.png
|
||||
yellow_200.png
|
||||
bulboff.png
|
||||
bulboff_150.png
|
||||
bulboff_200.png
|
||||
bulbon.png
|
||||
bulbon_150.png
|
||||
bulbon_200.png
|
||||
greenoff.png
|
||||
greenoff_150.png
|
||||
greenoff_200.png
|
||||
redoff.png
|
||||
redoff_150.png
|
||||
redoff_200.png
|
||||
yellowoff.png
|
||||
yellowoff_150.png
|
||||
yellowoff_200.png
|
||||
bulbdisabled.png
|
||||
bulbdisabled_150.png
|
||||
bulbdisabled_200.png
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
components/industrialstuff/resources/red_150.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
components/industrialstuff/resources/red_200.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
components/industrialstuff/resources/redoff.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
components/industrialstuff/resources/redoff_150.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
components/industrialstuff/resources/redoff_200.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
components/industrialstuff/resources/tadvled_150.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
components/industrialstuff/resources/tadvled_200.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 301 B |
BIN
components/industrialstuff/resources/tlednumber_150.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
components/industrialstuff/resources/tlednumber_200.png
Normal file
After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 706 B |
BIN
components/industrialstuff/resources/tstoplightsensor_150.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
components/industrialstuff/resources/tstoplightsensor_200.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
components/industrialstuff/resources/yellow_150.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
components/industrialstuff/resources/yellow_200.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
components/industrialstuff/resources/yellowoff.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
components/industrialstuff/resources/yellowoff_150.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
components/industrialstuff/resources/yellowoff_200.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
@ -56,6 +56,8 @@ type
|
||||
|
||||
protected
|
||||
FlipFLop : Boolean;
|
||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||
const AXProportion, AYProportion: Double); override;
|
||||
procedure DoChange(AState: TLedState); dynamic;
|
||||
procedure Loaded; override;
|
||||
public
|
||||
@ -181,16 +183,17 @@ begin
|
||||
inherited;
|
||||
if FKind <> lkCustom then
|
||||
BitmapNeeded;
|
||||
{
|
||||
end;
|
||||
|
||||
Try
|
||||
If (csDesigning in ComponentState) Then Exit ;
|
||||
// Load Bitmap if necessary
|
||||
BitmapNeeded;
|
||||
Finally
|
||||
inherited Loaded;
|
||||
End;
|
||||
}
|
||||
procedure TAdvLed.DoAutoAdjustLayout(
|
||||
const AMode: TLayoutAdjustmentPolicy;
|
||||
const AXProportion, AYProportion: Double);
|
||||
begin
|
||||
inherited DoAutoAdjustLayout(AMode, AXProportion, AYProportion);
|
||||
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||
begin
|
||||
BitmapNeeded;
|
||||
end;
|
||||
end;
|
||||
|
||||
// timer
|
||||
@ -231,14 +234,22 @@ const
|
||||
DisabledBitmaps: array[TLedKind] of string = ('LEDREDOFF', 'LEDGREENOFF',
|
||||
'LEDBLUEOFF', 'LEDYELLOWOFF', 'LEDPURPLEOFF', 'LEDBULBOFF' ,''); }
|
||||
OnBitmaps: array[TLedKind] of string = ('RED', 'GREEN', 'YELLOW', 'BULBON', '');
|
||||
OffBitmaps: array[TLedKind] of string = ('BLACK', 'BLACK', 'BLACK','BULBOFF', '');
|
||||
DisabledBitmaps: array[TLedKind] of string = ('BLACK', 'BLACK', 'BLACK','BULBOFF' ,'');
|
||||
OffBitmaps: array[TLedKind] of string = ('REDOFF', 'GREENOFF', 'YELLOWOFF','BULBOFF', '');
|
||||
DisabledBitmaps: array[TLedKind] of string = ('BLACK', 'BLACK', 'BLACK','BULBDISABLED' ,'');
|
||||
var
|
||||
resName: String;
|
||||
begin
|
||||
if LedKind <> lkCustom then
|
||||
begin
|
||||
FGlyphs[lsOn].LoadFromResourceName(HInstance, OnBitmaps[LedKind]);
|
||||
FGlyphs[lsOff].LoadFromResourceName(HInstance, OffBitmaps[LedKind]);
|
||||
FGlyphs[lsDisabled].LoadFromResourceName(HInstance, DisabledBitmaps[LedKind]);
|
||||
if Font.PixelsPerInch >=168 then
|
||||
resName := '_200'
|
||||
else if Font.PixelsPerInch >= 120 then
|
||||
resName := '_150'
|
||||
else
|
||||
resName := '';
|
||||
FGlyphs[lsOn].LoadFromResourceName(HInstance, OnBitmaps[LedKind] + resName);
|
||||
FGlyphs[lsOff].LoadFromResourceName(HInstance, OffBitmaps[LedKind] + resName);
|
||||
FGlyphs[lsDisabled].LoadFromResourceName(HInstance, DisabledBitmaps[LedKind] + resName);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -49,12 +49,14 @@ type
|
||||
FScaleFactor: Double;
|
||||
procedure SetBorderStyle(AValue: TLedNumberBorderStyle);
|
||||
procedure SetTransparent(AValue: boolean);
|
||||
procedure SetZeroToO(AValue: Boolean);
|
||||
protected{private}
|
||||
FBgColor : TColor;
|
||||
FOffColor : TColor;
|
||||
FOnColor : TColor;
|
||||
FColumns : Integer;
|
||||
FRows : Integer;
|
||||
FZeroToO : Boolean;
|
||||
FSize : TSegmentSize;
|
||||
FSlantAngle: Integer;
|
||||
FSlanted : Boolean;
|
||||
@ -69,6 +71,7 @@ type
|
||||
procedure PaintSegment(Segment: Integer; TheColor: TColor;
|
||||
Points: array of TPoint; OffsetX, OffsetY: Integer);
|
||||
procedure ResizeControl(Row, Col, ASize: Integer);
|
||||
procedure SetParent(NewParent: TWinControl); override;
|
||||
function GetAbout: string;
|
||||
function GetSlantAngle: Double;
|
||||
procedure SetAbout(const {%H-}Value: string);
|
||||
@ -79,7 +82,7 @@ type
|
||||
procedure SetOffColor(Value: TColor);
|
||||
procedure SetRows(Value: Integer);
|
||||
procedure SetColumns(Value: Integer);
|
||||
procedure SetbgColor(Value: TColor);
|
||||
procedure SetBGColor(Value: TColor);
|
||||
procedure SelectSegments(Segment: Word; Points: array of TPoint;
|
||||
OffsetX, OffsetY: Integer);
|
||||
protected
|
||||
@ -96,6 +99,7 @@ type
|
||||
property SlantAngle: Integer read FSlantAngle write SetSlantAngle default 5;
|
||||
property Slanted: Boolean read FSlanted write SetSlanted default false;
|
||||
property Transparent: boolean read FTransparent write SetTransparent default false; {Draws segments with transparent background.BgColor is used as mask color.}
|
||||
property ZeroToO: Boolean read FZeroToO write SetZeroToO default false;
|
||||
public
|
||||
constructor Create(AOwner:TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -104,6 +108,7 @@ type
|
||||
TLEDNumber = class(TCustomLEDNumber)
|
||||
published
|
||||
property Version;
|
||||
property BorderSpacing;
|
||||
property BorderStyle;
|
||||
property Caption;
|
||||
property Columns;
|
||||
@ -127,6 +132,7 @@ type
|
||||
property Slanted;
|
||||
property Transparent;
|
||||
property Visible;
|
||||
property ZeroToO;
|
||||
end;
|
||||
|
||||
|
||||
@ -235,6 +241,10 @@ const
|
||||
44, 0, 45, 0, 0, 0, 0, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44);
|
||||
|
||||
const
|
||||
BASE_WIDTH = 17;
|
||||
BASE_HEIGHT = 30;
|
||||
|
||||
|
||||
{===== TCustomLEDNumber ============================================}
|
||||
|
||||
@ -249,14 +259,15 @@ begin
|
||||
csSetCaption,
|
||||
csClickEvents,
|
||||
csDoubleClicks];
|
||||
Width := 170;
|
||||
Height := 30;
|
||||
FRows := 1;
|
||||
FColumns := 10;
|
||||
|
||||
Width := FColumns * BASE_WIDTH;
|
||||
Height := FRows * BASE_HEIGHT;
|
||||
FOnColor := clLime;
|
||||
FOffColor := $000E3432;
|
||||
FBgColor := clBlack;
|
||||
FSize := 2;
|
||||
FRows := 1;
|
||||
FColumns := 10;
|
||||
FSlantAngle := 5;
|
||||
Caption := 'LED-LABEL';
|
||||
lbDrawBmp := TBitmap.Create;
|
||||
@ -292,6 +303,13 @@ begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomLEDNumber.SetZeroToO(AValue: Boolean);
|
||||
begin
|
||||
if FZeroToO = AValue then Exit;
|
||||
FZeroToO := AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomLEDNumber.SetBorderStyle(AValue: TLedNumberBorderStyle);
|
||||
begin
|
||||
if FBorderStyle=AValue then Exit;
|
||||
@ -312,8 +330,6 @@ procedure TCustomLEDNumber.DoAutoAdjustLayout(
|
||||
begin
|
||||
inherited;
|
||||
FScalefactor := Font.PixelsPerInch / 96;
|
||||
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||
FScaleFactor *= Max(AXProportion, AYProportion)
|
||||
end;
|
||||
|
||||
procedure TCustomLEDNumber.SlantPoint(var P: TPoint;
|
||||
@ -336,7 +352,7 @@ begin
|
||||
if FSlanted and (FSlantAngle <> 0) then
|
||||
begin
|
||||
tanAlpha := tan(GetSlantAngle);
|
||||
baseY := round(FScaleFactor * 30 * (FSize - 1));
|
||||
baseY := round(FScaleFactor * BASE_HEIGHT * (FSize - 1));
|
||||
for i := 0 to MAX_POINTS do
|
||||
SlantPoint(Points[i], baseY, tanAlpha);
|
||||
end;
|
||||
@ -346,9 +362,9 @@ end;
|
||||
function TCustomLEDNumber.NewOffset(xOry: char; OldOffset: Integer): Integer;
|
||||
begin
|
||||
if (xOry = 'x')then
|
||||
Result := oldOffset + round(FScaleFactor * 17 * (FSize - 1))
|
||||
Result := oldOffset + round(FScaleFactor * BASE_WIDTH * (FSize - 1))
|
||||
else
|
||||
Result := oldOffset + round(FScaleFactor * 30 * (FSize - 1));
|
||||
Result := oldOffset + round(FScaleFactor * BASE_HEIGHT * (FSize - 1));
|
||||
end;
|
||||
{=====}
|
||||
|
||||
@ -415,8 +431,8 @@ var
|
||||
begin
|
||||
if (Segment and $FFFF) = $FFFF then begin
|
||||
MyColor := FOnColor;
|
||||
PaintSegment(17, MyColor, Points, OffsetX, OffsetY);
|
||||
PaintSegment(18, MyColor, Points, OffsetX, OffsetY);
|
||||
PaintSegment(BASE_WIDTH, MyColor, Points, OffsetX, OffsetY);
|
||||
PaintSegment(BASE_WIDTH+1, MyColor, Points, OffsetX, OffsetY);
|
||||
end
|
||||
else begin
|
||||
Bit := $8000;
|
||||
@ -451,7 +467,6 @@ begin
|
||||
Last := #0;
|
||||
OffsetX := FSize;
|
||||
OffsetY := 0;
|
||||
|
||||
DisplayStr := Caption;
|
||||
|
||||
if Length(DisplayStr) > 0 then
|
||||
@ -479,12 +494,13 @@ begin
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
end
|
||||
else begin
|
||||
OffsetX := OffsetX - round(FScaleFactor * 17 * (FSize - 1));
|
||||
OffsetX := OffsetX - round(FScaleFactor * BASE_WIDTH * (FSize - 1));
|
||||
Tmp := (Characters[CharacterNDX[Ord(Next)]] or Characters[CharacterNDX[Ord(Last)]]);
|
||||
SelectSegments(Tmp, Points, OffsetX, OffsetY);
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
end
|
||||
else begin
|
||||
if FZeroToO and (Next = '0') then Next := 'O';
|
||||
Tmp := Characters[CharacterNDX[Ord(Next)]];
|
||||
SelectSegments(Tmp, Points, OffsetX, OffsetY);
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
@ -546,8 +562,8 @@ begin
|
||||
FRows := Row;
|
||||
FColumns := Col;
|
||||
FSize := ASize;
|
||||
h := round(FScaleFactor * FRows * 30 * (FSize - 1));
|
||||
w := round(FScaleFactor * (FColumns * 17 * (FSize - 1)));
|
||||
h := round(FScaleFactor * FRows * BASE_HEIGHT * (FSize - 1));
|
||||
w := round(FScaleFactor * (FColumns * BASE_WIDTH * (FSize - 1)));
|
||||
if FSlanted and (FSlantAngle <> 0) then
|
||||
inc(w, round(h * tan(GetSlantAngle)));
|
||||
SetBounds(Left, Top, w, h);
|
||||
@ -555,10 +571,10 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetbgColor(Value: TColor);
|
||||
procedure TCustomLEDNumber.SetBGColor(Value: TColor);
|
||||
begin
|
||||
if FBgColor <> Value then begin
|
||||
FBgColor := Value;
|
||||
if FBGColor <> Value then begin
|
||||
FBGColor := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
@ -580,7 +596,12 @@ begin
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetParent(NewParent: TWinControl);
|
||||
begin
|
||||
inherited;
|
||||
Resizecontrol(FRows, FColumns, FSize);
|
||||
end;
|
||||
|
||||
procedure TCustomLEDNumber.SetRows(Value : Integer);
|
||||
begin
|
||||
|
@ -265,14 +265,9 @@ begin
|
||||
inherited DoAutoAdjustLayout(AMode, AXProportion, AYProportion);
|
||||
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||
begin
|
||||
DisableAutosizing;
|
||||
try
|
||||
case Orientation of
|
||||
soHorizontal : FButtonSize := Round(FButtonSize * AXProportion);
|
||||
soVertical : FButtonSize := Round(FButtonSize * AYProportion);
|
||||
end;
|
||||
finally
|
||||
EnableAutoSizing;
|
||||
case Orientation of
|
||||
soHorizontal : FButtonSize := Round(FButtonSize * AXProportion);
|
||||
soVertical : FButtonSize := Round(FButtonSize * AYProportion);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|