spktoolbar: Rename constant DPI_AWARE to SPK_DPI_AWARE (to distinguish from LCL scaling). Remove global DesignDPI variable.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6192 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
b1dfb45d3a
commit
856716b59f
@ -548,16 +548,9 @@ begin
|
||||
//todo: not found in lcl
|
||||
//inherited AlignWithMargins:=true;
|
||||
|
||||
if AOwner is TForm then
|
||||
{$IF LCL_FullVersion >= 1090000}
|
||||
DesignDPI := TForm(AOwner).DesignTimePPI
|
||||
{$ELSE}
|
||||
DesignDPI := TForm(AOwner).DesignTimeDPI
|
||||
{$ENDIF}
|
||||
else
|
||||
DesignDPI := ScreenInfo.PixelsPerInchX;
|
||||
if (AOwner is TForm) then
|
||||
SpkInitLayoutConsts(96); // This default dpi value is ignored for LCL scaling
|
||||
|
||||
SpkInitLayoutConsts(DesignDPI);
|
||||
inherited Height := ToolbarHeight;
|
||||
|
||||
//inherited Doublebuffered:=true;
|
||||
|
@ -436,21 +436,16 @@ begin
|
||||
ActionChange(Sender, False);
|
||||
end;
|
||||
|
||||
{ Draw a downward-facing filled triangle as dropdown arrow }
|
||||
procedure TSpkBaseButton.DrawDropdownArrow(ABuffer: TBitmap; ARect: TRect;
|
||||
AColor: TColor);
|
||||
const
|
||||
w = 8;
|
||||
h = 8;
|
||||
var
|
||||
P: array[0..3] of TPoint;
|
||||
wsc, hsc: Integer;
|
||||
begin
|
||||
wsc := ScaleX(w, DesignDPI); // 0 1
|
||||
hsc := ScaleY(h, DesignDPI); // 2
|
||||
P[2].x := ARect.Left + (ARect.Right - ARect.Left) div 2;
|
||||
P[2].y := ARect.Top + (ARect.Bottom - ARect.Top + hsc) div 2 - 1;
|
||||
P[0] := Point(P[2].x - wsc div 2, P[2].y - hsc div 2);
|
||||
P[1] := Point(P[2].x + wsc div 2, P[0].y);
|
||||
P[2].y := ARect.Top + (ARect.Bottom - ARect.Top + DropDownArrowHeight) div 2 - 1;
|
||||
P[0] := Point(P[2].x - DropDownArrowWidth div 2, P[2].y - DropDownArrowHeight div 2);
|
||||
P[1] := Point(P[2].x + DropDownArrowWidth div 2, P[0].y);
|
||||
P[3] := P[0];
|
||||
ABuffer.Canvas.Brush.Color := AColor;
|
||||
ABuffer.Canvas.Pen.Style := psClear;
|
||||
|
@ -19,14 +19,11 @@ uses
|
||||
|
||||
const
|
||||
{$IF lcl_fullversion < 1080000}
|
||||
DPI_AWARE = true;
|
||||
SPK_DPI_AWARE = true;
|
||||
{$ELSE}
|
||||
DPI_AWARE = false; // use lcl scaling instead
|
||||
SPK_DPI_AWARE = false; // use lcl scaling instead
|
||||
{$ENDIF}
|
||||
|
||||
var
|
||||
DesignDPI: Integer;
|
||||
|
||||
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
|
||||
function SpkScaleX(Size: Integer; FromDPI: Integer; ToDPI: Integer = 0): integer;
|
||||
function SpkScaleY(Size: Integer; FromDPI: Integer; ToDPI: Integer = 0): integer;
|
||||
@ -53,6 +50,9 @@ const
|
||||
SMALLBUTTON_DROPDOWN_WIDTH = 11;
|
||||
SMALLBUTTON_RADIUS = 4;
|
||||
|
||||
DROPDOWN_ARROW_WIDTH = 8;
|
||||
DROPDOWN_ARROW_HEIGHT = 8;
|
||||
|
||||
// ***********************
|
||||
// *** Tab page layout ***
|
||||
// ***********************
|
||||
@ -166,6 +166,9 @@ var
|
||||
SmallButtonRadius: Integer;
|
||||
SmallButtonMinWidth: Integer;
|
||||
|
||||
DropdownArrowWidth: Integer;
|
||||
DropdownArrowHeight: Integer;
|
||||
|
||||
|
||||
// ***********************
|
||||
// *** Tab page layout ***
|
||||
@ -275,7 +278,7 @@ uses
|
||||
|
||||
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
|
||||
begin
|
||||
if not DPI_AWARE then
|
||||
if not SPK_DPI_AWARE then
|
||||
ToDPI := FromDPI;
|
||||
|
||||
{$IfDef Darwin}
|
||||
@ -300,6 +303,9 @@ begin
|
||||
SmallButtonRadius := SMALLBUTTON_RADIUS;
|
||||
SmallButtonMinWidth := 2 * SmallButtonPadding + SmallButtonGlyphWidth;
|
||||
|
||||
DropdownArrowWidth := SpkScaleX(DROPDOWN_ARROW_WIDTH, FromDPI, ToDPI);
|
||||
DropdownArrowHeight := SpkScaleY(DROPDOWN_ARROW_HEIGHT, FromDPI, ToDPI);
|
||||
|
||||
MaxElementHeight := SpkScaleY(MAX_ELEMENT_HEIGHT, FromDPI, ToDPI);
|
||||
PaneRowHeight := SpkScaleY(PANE_ROW_HEIGHT, FromDPI, ToDPI);
|
||||
PaneFullRowHeight := 3 * PaneRowHeight;
|
||||
@ -363,7 +369,7 @@ begin
|
||||
if ToDPI = 0 then
|
||||
ToDPI := ScreenInfo.PixelsPerInchX;
|
||||
|
||||
if (not DPI_AWARE) or (ToDPI = FromDPI) then
|
||||
if (not SPK_DPI_AWARE) or (ToDPI = FromDPI) then
|
||||
Result := Size
|
||||
else
|
||||
begin
|
||||
@ -380,7 +386,7 @@ begin
|
||||
if ToDPI = 0 then
|
||||
ToDPI := ScreenInfo.PixelsPerInchY;
|
||||
|
||||
if (not DPI_AWARE) or (ToDPI = FromDPI) then
|
||||
if (not SPK_DPI_AWARE) or (ToDPI = FromDPI) then
|
||||
Result := Size
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user