소스 검색

5.0.1 with delphi compatibility

lainz 7 년 전
부모
커밋
b80ec4f6cd
64개의 변경된 파일5720개의 추가작업 그리고 771개의 파일을 삭제
  1. 1473 24
      bcbasectrls.pas
  2. 8 2
      bcbrightandcontrast.pas
  3. 94 45
      bcbutton.pas
  4. 106 50
      bcbuttonfocus.pas
  5. 13 5
      bcdefaultthememanager.pas
  6. 13 6
      bceffect.pas
  7. 19 14
      bcfilters.pas
  8. 14 4
      bcgamegrid.pas
  9. 74 106
      bcimagebutton.pas
  10. 56 38
      bckeyboard.pas
  11. 49 24
      bclabel.pas
  12. 31 7
      bclistbox.pas
  13. 23 12
      bcmaterialdesignbutton.pas
  14. 61 21
      bcmdbutton.pas
  15. 69 27
      bcmdbuttonfocus.pas
  16. 43 22
      bcnumerickeyboard.pas
  17. 53 25
      bcpanel.pas
  18. 22 5
      bcradialprogressbar.pas
  19. 61 0
      bcreg.pas
  20. 39 1
      bcrtti.pas
  21. 37 27
      bcsamples.pas
  22. 63 7
      bcstylesform.pas
  23. 11 3
      bcsvgbutton.pas
  24. 31 20
      bcsvgviewer.pas
  25. 10 4
      bcthememanager.pas
  26. 36 5
      bctoolbar.pas
  27. 11 5
      bctools.pas
  28. 25 14
      bctrackbarupdown.pas
  29. 98 11
      bctypes.pas
  30. 93 0
      bgracontrols.dpk
  31. 225 0
      bgracontrols.dproj
  32. 2 0
      bgracontrols.dproj.local
  33. 13 0
      bgracontrols.inc
  34. 86 80
      bgracontrols.lpk
  35. 12 12
      bgracontrols.pas
  36. 10 0
      bgracontrols.stat
  37. 10 3
      bgracustomdrawn.pas
  38. 24 10
      bgraflashprogressbar.pas
  39. 23 6
      bgragraphiccontrol.pas
  40. 18 3
      bgraimagelist.pas
  41. 36 6
      bgraimagemanipulation.pas
  42. 28 16
      bgraknob.pas
  43. 6 1
      bgrapascalscript.pas
  44. 6 1
      bgrapascalscriptcomponent.pas
  45. 15 6
      bgraresizespeedbutton.pas
  46. 7 7
      bgrascript.pas
  47. 27 10
      bgrashape.pas
  48. 22 16
      bgraspeedbutton.pas
  49. 21 17
      bgraspriteanimation.pas
  50. 28 12
      bgravirtualscreen.pas
  51. 17 9
      colorspeedbutton.pas
  52. 16 7
      dtanalogclock.pas
  53. 902 0
      dtanalogcommon.pas
  54. 496 0
      dtanaloggauge.pas
  55. 16 8
      dtthemedclock.pas
  56. 280 0
      dtthemedgauge.pas
  57. 91 0
      lcl/KeyInputIntf.pas
  58. 50 0
      lcl/MouseAndKeyInput.pas
  59. 283 0
      lcl/MouseInputIntf.pas
  60. 71 0
      lcl/WinKeyInput.pas
  61. 126 0
      lcl/WinMouseInput.pas
  62. 12 3
      materialcolors.pas
  63. 2 2
      update_bgracontrols_force.json
  64. 3 2
      upsi_bgrapascalscript.pas

+ 1473 - 24
bcbasectrls.pas

@@ -28,17 +28,356 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+
 unit BCBaseCtrls;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, Controls, BGRABitmap, BGRABitmapTypes;
+  Classes, SysUtils, Types, Controls, ExtCtrls, Graphics,
+  {$IFNDEF FPC}Windows, Messages, BGRAGraphics, GraphType, FPImage, {$ELSE} LCLType,{$ENDIF}
+  BGRABitmap, BGRABitmapTypes;
 
 type
 
+{$IFNDEF FPC}
+  TSpacingSize = Integer;
+  TControlCellAlign = (
+    ccaFill,
+    ccaLeftTop,
+    ccaRightBottom,
+    ccaCenter
+    );
+  TControlCellAligns = set of TControlCellAlign;
+
+  TControlBorderSpacingDefault = record
+    Left: TSpacingSize;
+    Top: TSpacingSize;
+    Right: TSpacingSize;
+    Bottom: TSpacingSize;
+    Around: TSpacingSize;
+  end;
+  PControlBorderSpacingDefault = ^TControlBorderSpacingDefault;
+
+
+  TBGRAGraphicCtrl = class;
+  TBGRACustomCtrl  = class;
+  TControlBorderSpacing = class;
+
+  ILCLControl = interface
+   ['{97A3D274-C4BD-4095-9B23-8E50D6E0EA24}']
+    procedure DoOnResize;
+    procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;{%H-}WithThemeSpace: boolean);
+    procedure MouseEnter;
+    procedure MouseLeave;
+    procedure TextChanged;
+    procedure FontChanged(Sender: TObject);
+    procedure RealSetText(const Value: TCaption);
+    procedure Resize;
+    procedure SetColor(Value: TColor);
+    function GetColor : TColor;
+    function ColorIsStored: boolean;
+    function RealGetText: TCaption;
+    function CreateControlBorderSpacing: TControlBorderSpacing;
+    procedure SetBorderSpacing(const AValue: TControlBorderSpacing);
+    procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer);
+    procedure InvalidatePreferredSize;
+    procedure EnableAutoSizing;
+    procedure DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean);
+    function  GetInstance : TObject;
+    function IsInnerBorderStored: boolean;
+  end;
+
+  TControlBorderSpacing = class(TPersistent)
+  private
+    FAround: TSpacingSize;
+    FBottom: TSpacingSize;
+    FCellAlignHorizontal: TControlCellAlign;
+    FCellAlignVertical: TControlCellAlign;
+    FControl: ILCLControl;
+    FInnerBorder: Integer;
+    FLeft: TSpacingSize;
+    FOnChange: TNotifyEvent;
+    FRight: TSpacingSize;
+    FTop: TSpacingSize;
+    FDefault: PControlBorderSpacingDefault;
+    function GetAroundBottom: Integer;
+    function GetAroundLeft: Integer;
+    function GetAroundRight: Integer;
+    function GetAroundTop: Integer;
+    function GetControlBottom: Integer;
+    function GetControlHeight: Integer;
+    function GetControlLeft: Integer;
+    function GetControlRight: Integer;
+    function GetControlTop: Integer;
+    function GetControlWidth: Integer;
+    function IsAroundStored: boolean;
+    function IsBottomStored: boolean;
+    function IsInnerBorderStored: boolean;
+    function IsLeftStored: boolean;
+    function IsRightStored: boolean;
+    function IsTopStored: boolean;
+    procedure SetAround(const AValue: TSpacingSize);
+    procedure SetBottom(const AValue: TSpacingSize);
+    procedure SetCellAlignHorizontal(const AValue: TControlCellAlign);
+    procedure SetCellAlignVertical(const AValue: TControlCellAlign);
+    procedure SetInnerBorder(const AValue: Integer);
+    procedure SetLeft(const AValue: TSpacingSize);
+    procedure SetRight(const AValue: TSpacingSize);
+    procedure SetSpace(Kind: TAnchorKind; const AValue: integer);
+    procedure SetTop(const AValue: TSpacingSize);
+  protected
+    procedure Change(InnerSpaceChanged: Boolean); virtual;
+  public
+    constructor Create(OwnerControl: ILCLControl; ADefault: PControlBorderSpacingDefault = nil);
+    procedure Assign(Source: TPersistent); override;
+    procedure AssignTo(Dest: TPersistent); override;
+    function IsEqual(Spacing: TControlBorderSpacing): boolean;
+    procedure GetSpaceAround(var SpaceAround: TRect); virtual;
+    function GetSideSpace(Kind: TAnchorKind): Integer; // Around+GetSpace
+    function GetSpace(Kind: TAnchorKind): Integer; virtual;
+    procedure AutoAdjustLayout(const AXProportion, AYProportion: Double);
+  public
+    property Control: ILCLControl read FControl;
+    property Space[Kind: TAnchorKind]: integer read GetSpace write SetSpace;
+    property AroundLeft: Integer read GetAroundLeft;
+    property AroundTop: Integer read GetAroundTop;
+    property AroundRight: Integer read GetAroundRight;
+    property AroundBottom: Integer read GetAroundBottom;
+    property ControlLeft: Integer read GetControlLeft;
+    property ControlTop: Integer read GetControlTop;
+    property ControlWidth: Integer read GetControlWidth;
+    property ControlHeight: Integer read GetControlHeight;
+    property ControlRight: Integer read GetControlRight;
+    property ControlBottom: Integer read GetControlBottom;
+  published
+    property OnChange: TNotifyEvent read FOnChange write FOnChange;
+    property Left: TSpacingSize read FLeft write SetLeft stored IsLeftStored;
+    property Top: TSpacingSize read FTop write SetTop stored IsTopStored;
+    property Right: TSpacingSize read FRight write SetRight stored IsRightStored;
+    property Bottom: TSpacingSize read FBottom write SetBottom stored IsBottomStored;
+    property Around: TSpacingSize read FAround write SetAround stored IsAroundStored;
+    property InnerBorder: Integer read FInnerBorder write SetInnerBorder stored IsInnerBorderStored default 0;
+    property CellAlignHorizontal: TControlCellAlign read FCellAlignHorizontal write SetCellAlignHorizontal default ccaFill;
+    property CellAlignVertical: TControlCellAlign read FCellAlignVertical write SetCellAlignVertical default ccaFill;
+  end;
+
+  TChildControlResizeStyle = (
+      crsAnchorAligning, // (like Delphi)
+      crsScaleChilds, // scale children equally, keep space between children fixed
+      crsHomogenousChildResize, // enlarge children equally (i.e. by the same amount of pixel)
+      crsHomogenousSpaceResize // enlarge space between children equally
+      {$IFDEF EnablecrsSameSize}
+      ,crsSameSize  // each child gets the same size (maybe one pixel difference)
+      {$ENDIF}
+    );
+
+  TControlChildrenLayout = (
+      cclNone,
+      cclLeftToRightThenTopToBottom, // if BiDiMode <> bdLeftToRight then it becomes RightToLeft
+      cclTopToBottomThenLeftToRight
+    );
+
+  TControlChildSizing = class(TPersistent)
+  private
+    FControl: ILCLControl;
+    FControlsPerLine: integer;
+    FEnlargeHorizontal: TChildControlResizeStyle;
+    FEnlargeVertical: TChildControlResizeStyle;
+    FHorizontalSpacing: integer;
+    FLayout: TControlChildrenLayout;
+    FLeftRightSpacing: integer;
+    FOnChange: TNotifyEvent;
+    FShrinkHorizontal: TChildControlResizeStyle;
+    FShrinkVertical: TChildControlResizeStyle;
+    FTopBottomSpacing: integer;
+    FVerticalSpacing: integer;
+    procedure SetControlsPerLine(const AValue: integer);
+    procedure SetEnlargeHorizontal(const AValue: TChildControlResizeStyle);
+    procedure SetEnlargeVertical(const AValue: TChildControlResizeStyle);
+    procedure SetHorizontalSpacing(const AValue: integer);
+    procedure SetLayout(const AValue: TControlChildrenLayout);
+    procedure SetLeftRightSpacing(const AValue: integer);
+    procedure SetShrinkHorizontal(const AValue: TChildControlResizeStyle);
+    procedure SetShrinkVertical(const AValue: TChildControlResizeStyle);
+    procedure SetTopBottomSpacing(const AValue: integer);
+    procedure SetVerticalSpacing(const AValue: integer);
+  protected
+    procedure Change; virtual;
+  public
+    constructor Create(OwnerControl: ILCLControl);
+    procedure Assign(Source: TPersistent); override;
+    procedure AssignTo(Dest: TPersistent); override;
+    function IsEqual(Sizing: TControlChildSizing): boolean;
+    procedure SetGridSpacing(Spacing: integer);
+  public
+    property Control: ILCLControl read FControl;
+    property OnChange: TNotifyEvent read FOnChange write FOnChange;
+  published
+    property LeftRightSpacing: integer read FLeftRightSpacing write SetLeftRightSpacing default 0;
+    property TopBottomSpacing: integer read FTopBottomSpacing write SetTopBottomSpacing default 0;
+    property HorizontalSpacing: integer read FHorizontalSpacing write SetHorizontalSpacing default 0;
+    property VerticalSpacing: integer read FVerticalSpacing write SetVerticalSpacing default 0;
+    property EnlargeHorizontal: TChildControlResizeStyle read FEnlargeHorizontal
+                           write SetEnlargeHorizontal default crsAnchorAligning;
+    property EnlargeVertical: TChildControlResizeStyle read FEnlargeVertical
+                             write SetEnlargeVertical default crsAnchorAligning;
+    property ShrinkHorizontal: TChildControlResizeStyle read FShrinkHorizontal
+                            write SetShrinkHorizontal default crsAnchorAligning;
+    property ShrinkVertical: TChildControlResizeStyle read FShrinkVertical
+                              write SetShrinkVertical default crsAnchorAligning;
+    property Layout: TControlChildrenLayout read FLayout write SetLayout default cclNone;
+    property ControlsPerLine: integer read FControlsPerLine write SetControlsPerLine default 0;
+  end;
+{$ENDIF}
+
+{$IFDEF FPC}
+  TBGRAGraphicCtrl = class(TGraphicControl)
+{$ELSE}
+  TBGRAGraphicCtrl = class(TGraphicControl, ILCLControl)
+  protected
+    FBorderSpacing: TControlBorderSpacing;
+    FOnChange: TNotifyEvent;
+    FMouseInClient: boolean;
+    procedure DoOnResize; virtual;
+    procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;{%H-}WithThemeSpace: boolean); virtual;
+    procedure MouseEnter;  virtual;
+    procedure MouseLeave;  virtual;
+    procedure TextChanged; virtual;
+    procedure FontChanged(Sender: TObject); virtual;
+    procedure RealSetText(const Value: TCaption); virtual;
+    procedure Resize; override;
+    class function GetControlClassDefaultSize: TSize; virtual;
+    procedure SetColor(Value: TColor); virtual;
+    function GetColor : TColor;
+    procedure CMMouseEnter(var Message :TMessage); message CM_MOUSEENTER;
+    procedure CMMouseLeave(var Message :TMessage); message CM_MOUSELEAVE;
+    procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
+    function ColorIsStored: boolean; virtual;
+    function RealGetText: TCaption; virtual;
+    function CreateControlBorderSpacing: TControlBorderSpacing; virtual;
+    procedure SetBorderSpacing(const AValue: TControlBorderSpacing);
+    procedure DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean); virtual;
+    function  GetInstance : TObject;
+    function IsInnerBorderStored: boolean;
+  public
+    constructor Create(TheOwner: TComponent);override;
+    destructor Destroy;override;
+    procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
+    procedure InvalidatePreferredSize; virtual;
+    procedure EnableAutoSizing;
+    property Color: TColor read GetColor write SetColor stored ColorIsStored default clWindow;
+    property BorderSpacing: TControlBorderSpacing read FBorderSpacing write SetBorderSpacing;
+    property Caption;
+    property Canvas;
+{$ENDIF}
+  end;
+
+{$IFDEF FPC}
+  TBGRACustomCtrl = class(TCustomControl)
+{$ELSE}
+  TBGRACustomCtrl = class(TCustomControl, ILCLControl)
+  protected
+    FBorderSpacing: TControlBorderSpacing;
+    FChildSizing: TControlChildSizing;
+    FOnChange: TNotifyEvent;
+    FMouseInClient: boolean;
+    procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;{%H-}WithThemeSpace: boolean); {$IFDEF FPC}override;{$ELSE}virtual;{$ENDIF}
+    procedure DoOnResize; virtual;
+    procedure MouseEnter; virtual;
+    procedure MouseLeave; virtual;
+    procedure TextChanged; virtual;
+    procedure FontChanged(Sender: TObject); virtual;
+    function GetDefaultDockCaption: String; virtual;
+    procedure RealSetText(const Value: TCaption); virtual;
+    procedure EnabledChanged; virtual;
+    procedure Resize; override;
+    class function GetControlClassDefaultSize: TSize; virtual;
+    procedure SetColor(Value: TColor); virtual;
+    function  GetColor : TColor;
+    procedure UTF8KeyPress(var UTF8Key: {$IFDEF FPC}TUTF8Char{$ELSE}String{$ENDIF}); virtual;
+    procedure CMMouseEnter(var Message :TMessage); message CM_MOUSEENTER;
+    procedure CMMouseLeave(var Message :TMessage); message CM_MOUSELEAVE;
+    procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
+    function ColorIsStored: boolean; virtual;
+    function RealGetText: TCaption; virtual;
+    function CreateControlBorderSpacing: TControlBorderSpacing; virtual;
+    procedure SetBorderSpacing(const AValue: TControlBorderSpacing);
+    procedure DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean); virtual;
+    function  GetInstance : TObject;
+    function IsInnerBorderStored: boolean;
+    procedure SetChildSizing(const AValue: TControlChildSizing);
+    procedure DoChildSizingChange(Sender: TObject); virtual;
+  public
+    constructor Create(TheOwner: TComponent);override;
+    destructor Destroy;override;
+    procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
+    procedure InvalidatePreferredSize; virtual;
+    procedure EnableAutoSizing;
+    property Color: TColor read GetColor write SetColor stored ColorIsStored default clWindow;
+    property BorderSpacing: TControlBorderSpacing read FBorderSpacing write SetBorderSpacing;
+    property ChildSizing: TControlChildSizing read FChildSizing write SetChildSizing;
+    property Caption;
+    property Canvas;
+{$ENDIF}
+  end;
+
+
+{$IFDEF FPC}
+  TBGRACustomPanel = class(TCustomPanel)
+{$ELSE}
+  TBGRACustomPanel = class(TCustomPanel, ILCLControl)
+  protected
+    FBorderSpacing: TControlBorderSpacing;
+    FChildSizing: TControlChildSizing;
+    FOnChange: TNotifyEvent;
+    FMouseInClient: boolean;
+    procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;{%H-}WithThemeSpace: boolean); {$IFDEF FPC}override;{$ELSE}virtual;{$ENDIF}
+    procedure DoOnResize; virtual;
+    procedure MouseEnter; virtual;
+    procedure MouseLeave; virtual;
+    procedure TextChanged; virtual;
+    procedure FontChanged(Sender: TObject); virtual;
+    function GetDefaultDockCaption: String; virtual;
+    procedure RealSetText(const Value: TCaption); virtual;
+    procedure EnabledChanged; virtual;
+    procedure Resize; override;
+    class function GetControlClassDefaultSize: TSize; virtual;
+    procedure SetColor(Value: TColor); virtual;
+    function  GetColor : TColor;
+    procedure UTF8KeyPress(var UTF8Key: {$IFDEF FPC}TUTF8Char{$ELSE}String{$ENDIF}); virtual;
+    procedure CMMouseEnter(var Message :TMessage); message CM_MOUSEENTER;
+    procedure CMMouseLeave(var Message :TMessage); message CM_MOUSELEAVE;
+    procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
+    function ColorIsStored: boolean; virtual;
+    function RealGetText: TCaption; virtual;
+    function CreateControlBorderSpacing: TControlBorderSpacing; virtual;
+    procedure SetBorderSpacing(const AValue: TControlBorderSpacing);
+    procedure DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean); virtual;
+    function  GetInstance : TObject;
+    function IsInnerBorderStored: boolean;
+    procedure SetChildSizing(const AValue: TControlChildSizing);
+    procedure DoChildSizingChange(Sender: TObject); virtual;
+  public
+    constructor Create(TheOwner: TComponent);override;
+    destructor Destroy;override;
+    procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
+    procedure InvalidatePreferredSize; virtual;
+    procedure EnableAutoSizing;
+    property Color: TColor read GetColor write SetColor stored ColorIsStored default clWindow;
+    property BorderSpacing: TControlBorderSpacing read FBorderSpacing write SetBorderSpacing;
+    property ChildSizing: TControlChildSizing read FChildSizing write SetChildSizing;
+    property Canvas;
+{$ENDIF}
+  end;
+
   TOnBCPropertyChange = procedure(ASender: TObject; AData: PtrInt) of object;
 
   { TBCProperty
@@ -79,16 +418,16 @@ type
     debug functions
   }
 
-  TBCGraphicControl = class(TGraphicControl)
+  TBCGraphicControl = class(TBGRAGraphicCtrl)
   private
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     FPaintCount: Integer;
     {$ENDIF}
     FUpdateCount: Integer;
   protected
     procedure DoOnResize; override;
   protected
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     function GetDebugText: String; virtual;
     {$ENDIF}
     procedure Paint; override; // do not override in descendants!
@@ -99,6 +438,15 @@ type
     // general action occur which change "body" e.g. resize)
     procedure RenderControl; virtual;
   public
+    {$IFDEF FPC}
+    { Save all published settings to file }
+    procedure SaveToFile(AFileName: string); virtual; abstract;
+    { Load and assign all published settings from file }
+    procedure LoadFromFile(AFileName: string); virtual; abstract;
+    { Assign the properties from AFileName to this instance }
+    procedure AssignFromFile(AFileName: string); virtual; abstract;
+    { Used by SaveToFile/LoadFromFile }
+    {$ENDIF}
     constructor Create(AOwner: TComponent); override;
     // This disable DrawControl method
     procedure BeginUpdate; virtual;
@@ -142,16 +490,16 @@ type
     debug functions
   }
 
-  TBCCustomControl = class(TCustomControl)
+  TBCCustomControl = class(TBGRACustomCtrl)
   private
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     FPaintCount: Integer;
     {$ENDIF}
     FUpdateCount: Integer;
   protected
     procedure DoOnResize; override;
   protected
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     function GetDebugText: String; virtual;
     {$ENDIF}
     procedure Paint; override; // do not override in descendants!
@@ -191,16 +539,18 @@ type
     property StyleExtension: String read GetStyleExtension;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-{$IFDEF DEBUG} uses Graphics; {$ENDIF}
+//{$IFDEF INDEBUG} uses Graphics; {$ENDIF}
 
+{$IFDEF FPC}
 procedure Register;
 begin
   RegisterNoIcon([TBCCustomControl]);
 end;
+{$ENDIF}
 
 { TBCStyleCustomControl }
 
@@ -240,7 +590,7 @@ begin
   RenderControl;
 end;
 
-{$IFDEF DEBUG}
+{$IFDEF INDEBUG}
 function TBCCustomControl.GetDebugText: String;
 begin
   Result := EmptyStr;
@@ -249,12 +599,12 @@ end;
 
 procedure TBCCustomControl.Paint;
 begin
-  if (csCreating in FControlState) or IsUpdating then
+  if (csCreating in ControlState) or IsUpdating then
     Exit;
 
   DrawControl;
-  {$IFDEF DEBUG}
-  FPaintCount += 1;
+  {$IFDEF INDEBUG}
+  FPaintCount := FPaintCount +1;
   Canvas.Brush.Style := bsSolid;
   Canvas.Brush.Color := clBlack;
   Canvas.Font.Color := clWhite;
@@ -276,21 +626,21 @@ end;
 constructor TBCCustomControl.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FPaintCount := 0;
   {$ENDIF}
 end;
 
 procedure TBCCustomControl.BeginUpdate;
 begin
-  FUpdateCount += 1;
+  FUpdateCount := FUpdateCount +1;
 end;
 
 procedure TBCCustomControl.EndUpdate;
 begin
   if FUpdateCount > 0 then
   begin
-    FUpdateCount -= 1;
+    FUpdateCount := FUpdateCount -1;
     if FUpdateCount=0 then
       UpdateControl;
   end;
@@ -329,7 +679,7 @@ begin
   RenderControl;
 end;
 
-{$IFDEF DEBUG}
+{$IFDEF INDEBUG}
 function TBCGraphicControl.GetDebugText: String;
 begin
   Result := EmptyStr;
@@ -339,11 +689,11 @@ end;
 procedure TBCGraphicControl.Paint;
 begin
   //inherited Paint;
-  if (csCreating in FControlState) or IsUpdating then
+  if (csCreating in ControlState) or IsUpdating then
     Exit;
   DrawControl;
-  {$IFDEF DEBUG}
-  FPaintCount += 1;
+  {$IFDEF INDEBUG}
+  FPaintCount := FPaintCount +1;
   Canvas.Brush.Style := bsSolid;
   Canvas.Brush.Color := clBlack;
   Canvas.Font.Color := clWhite;
@@ -364,21 +714,21 @@ end;
 constructor TBCGraphicControl.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FPaintCount := 0;
   {$ENDIF}
 end;
 
 procedure TBCGraphicControl.BeginUpdate;
 begin
-  FUpdateCount += 1;
+  FUpdateCount := FUpdateCount +1;
 end;
 
 procedure TBCGraphicControl.EndUpdate;
 begin
   if FUpdateCount > 0 then
   begin
-    FUpdateCount -= 1;
+    FUpdateCount := FUpdateCount -1;
     if FUpdateCount=0 then
       UpdateControl;
   end;
@@ -409,5 +759,1104 @@ begin
   SetSize(0,0);
 end;
 
+{$IFNDEF FPC}
+constructor TBGRAGraphicCtrl.Create(TheOwner: TComponent);
+begin
+  inherited Create(TheOwner);
+  FBorderSpacing := CreateControlBorderSpacing;
+  FOnChange := Font.OnChange;
+  Font.OnChange := FontChanged;
+end;
+
+function TBGRAGraphicCtrl.CreateControlBorderSpacing: TControlBorderSpacing;
+begin
+  Result := TControlBorderSpacing.Create(Self);
+end;
+
+destructor TBGRAGraphicCtrl.Destroy;
+begin
+  FreeAndNil(FBorderSpacing);
+  inherited;
+end;
+
+procedure TBGRAGraphicCtrl.DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean);
+var
+  IParent : ILCLControl;
+begin
+  if Parent <> nil then
+    if Supports(Parent, ILCLControl, IParent) then
+       IParent.InvalidatePreferredSize;
+  AdjustSize;
+end;
+
+procedure TBGRAGraphicCtrl.DoOnResize;
+begin
+  if Assigned(OnResize) then
+    OnResize(Self);
+end;
+
+procedure TBGRAGraphicCtrl.SetBorderSpacing(const AValue: TControlBorderSpacing);
+begin
+  if FBorderSpacing=AValue then exit;
+  FBorderSpacing.Assign(AValue);
+end;
+
+procedure TBGRAGraphicCtrl.SetColor(Value: TColor);
+begin
+  if inherited Color <> Value then
+  begin
+    inherited Color := Value;
+    ParentColor := False;
+    Perform(CM_COLORCHANGED, 0, 0);
+    Invalidate;
+  end;
+end;
+
+function TBGRAGraphicCtrl.GetColor: TColor;
+begin
+   Result := inherited Color;
+end;
+
+procedure TBGRAGraphicCtrl.EnableAutoSizing;
+begin
+end;
+
+class function TBGRAGraphicCtrl.GetControlClassDefaultSize: TSize;
+begin
+  Result.CX := 75;
+  Result.CY := 50;
+end;
+
+function TBGRAGraphicCtrl.GetInstance: TObject;
+begin
+  result := Self;
+end;
+
+procedure TBGRAGraphicCtrl.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;{%H-}WithThemeSpace: boolean);
+begin
+  PreferredWidth:=0;
+  PreferredHeight:=0;
+end;
+
+procedure TBGRAGraphicCtrl.MouseEnter;
+begin
+  if Assigned(OnMouseEnter) then
+    OnMouseEnter(Self);
+end;
+
+procedure TBGRAGraphicCtrl.MouseLeave;
+begin
+  if Assigned(OnMouseLeave) then
+    OnMouseLeave(Self);
+end;
+
+procedure TBGRAGraphicCtrl.TextChanged;
+begin
+  // overrided;
+end;
+
+procedure TBGRAGraphicCtrl.FontChanged(Sender: TObject);
+begin
+  ParentFont := False;
+  DesktopFont := False;
+  Invalidate;
+  Perform(CM_FONTCHANGED, 0, 0);
+  if AutoSize then
+  begin
+    InvalidatePreferredSize;
+    AdjustSize;
+  end;
+  if Assigned(FOnChange) then
+    FOnChange(Self);  
+end;
+
+function TBGRAGraphicCtrl.RealGetText: TCaption;
+begin
+  Result := Caption;
+end;
+
+procedure TBGRAGraphicCtrl.RealSetText(const Value: TCaption);
+begin
+  if RealGetText = Value then Exit;
+  Caption := Value;
+  Perform(CM_TEXTCHANGED, 0, 0);
+end;
+
+procedure TBGRAGraphicCtrl.InvalidatePreferredSize;
+begin
+//  Invalidate;
+end;
+
+function TBGRAGraphicCtrl.IsInnerBorderStored: boolean;
+begin
+  Result:=BorderSpacing.InnerBorder<>0;
+end;
+
+procedure TBGRAGraphicCtrl.Resize;
+begin
+  inherited;
+  Invalidate;
+  DoOnResize;
+end;
+
+function TBGRAGraphicCtrl.ColorIsStored: boolean;
+begin
+  Result := not ParentColor;
+end;
+
+procedure TBGRAGraphicCtrl.SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer);
+begin
+  {if (csLoading in ComponentState)
+  or ((Owner<>nil) and (csLoading in Owner.ComponentState)) then
+    exit;}
+  SetBounds(aLeft,aTop,aWidth,aHeight);
+//  DoOnResize;
+end;
+
+procedure TBGRAGraphicCtrl.CMTextChanged(var Message: TMessage);
+begin
+  inherited;
+  TextChanged;
+end;
+
+procedure TBGRAGraphicCtrl.CMMouseEnter(var Message: TMessage);
+begin
+  if FMouseInClient then
+    Exit;
+
+  FMouseInClient := True;
+
+  // broadcast to parents first
+  if Assigned(Parent) then
+    Parent.Perform(CM_MOUSEENTER, 0, LParam(Self));
+
+  // if it is not a child message then perform an event
+  if (Message.LParam = 0) then
+    MouseEnter;
+end;
+
+procedure TBGRAGraphicCtrl.CMMouseLeave(var Message: TMessage);
+begin
+  if not FMouseInClient then
+    Exit;
+
+  FMouseInClient := False;
+
+  // broadcast to parents first
+  if Assigned(Parent) then
+    Parent.Perform(CM_MOUSELEAVE, 0, LParam(Self));
+
+  // if it is not a child message then perform an event
+  if (Message.LParam = 0) then
+    MouseLeave;
+end;
+
+{TBGRACustomCtrl}
+
+constructor TBGRACustomCtrl.Create(TheOwner: TComponent);
+begin
+  inherited Create(TheOwner);
+  FBorderSpacing := CreateControlBorderSpacing;
+  FChildSizing:=TControlChildSizing.Create(Self);
+  FChildSizing.OnChange := DoChildSizingChange;
+  FOnChange := Font.OnChange;
+  Font.OnChange := FontChanged;
+end;
+
+function TBGRACustomCtrl.CreateControlBorderSpacing: TControlBorderSpacing;
+begin
+  Result := TControlBorderSpacing.Create(Self);
+end;
+
+destructor TBGRACustomCtrl.Destroy;
+begin
+  FreeAndNil(FBorderSpacing);
+  FreeAndNil(FChildSizing);
+  inherited;
+end;
+
+procedure TBGRACustomCtrl.DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean);
+var
+  IParent : ILCLControl;
+begin
+  if Parent <> nil then
+    if Supports(Parent, ILCLControl, IParent) then
+       IParent.InvalidatePreferredSize;
+  AdjustSize;
+end;
+
+procedure TBGRACustomCtrl.DoChildSizingChange(Sender: TObject);
+begin
+  //debugln('TWinControl.DoChildSizingChange ',DbgSName(Self));
+  if ControlCount=0 then exit;
+  InvalidatePreferredSize;
+  ReAlign;
+end;
+
+procedure TBGRACustomCtrl.DoOnResize;
+begin
+  if Assigned(OnResize) then
+    OnResize(Self);
+end;
+
+procedure TBGRACustomCtrl.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;{%H-}WithThemeSpace: boolean);
+begin
+  PreferredWidth:=0;
+  PreferredHeight:=0;
+end;
+
+procedure TBGRACustomCtrl.MouseEnter;
+begin
+  if Assigned(OnMouseEnter) then
+    OnMouseEnter(Self);
+end;
+
+procedure TBGRACustomCtrl.MouseLeave;
+begin
+  if Assigned(OnMouseLeave) then
+    OnMouseLeave(Self);
+end;
+
+procedure TBGRACustomCtrl.TextChanged;
+begin
+  // overrided;
+end;
+
+procedure TBGRACustomCtrl.FontChanged(Sender: TObject);
+begin
+  ParentFont := False;
+  DesktopFont := False;
+  Invalidate;
+  Perform(CM_FONTCHANGED, 0, 0);
+  if AutoSize then
+  begin
+    InvalidatePreferredSize;
+    AdjustSize;
+  end;
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+function TBGRACustomCtrl.GetDefaultDockCaption: String;
+begin
+end;
+
+function TBGRACustomCtrl.GetInstance: TObject;
+begin
+  result := Self;
+end;
+
+function TBGRACustomCtrl.RealGetText: TCaption;
+begin
+  Result := Caption;
+end;
+
+procedure TBGRACustomCtrl.RealSetText(const Value: TCaption);
+begin
+  if RealGetText = Value then Exit;
+  Caption := Value;
+  Perform(CM_TEXTCHANGED, 0, 0);
+end;
+
+procedure TBGRACustomCtrl.EnabledChanged;
+begin
+end;
+
+procedure TBGRACustomCtrl.InvalidatePreferredSize;
+begin
+//  Invalidate;
+end;
+
+function TBGRACustomCtrl.IsInnerBorderStored: boolean;
+begin
+  Result:=BorderSpacing.InnerBorder<>0;
+end;
+
+procedure TBGRACustomCtrl.Resize;
+begin
+  inherited;
+  Invalidate;
+  DoOnResize;
+end;
+
+procedure TBGRACustomCtrl.SetBorderSpacing(const AValue: TControlBorderSpacing);
+begin
+  if FBorderSpacing=AValue then exit;
+  FBorderSpacing.Assign(AValue);
+end;
+
+procedure TBGRACustomCtrl.SetChildSizing(const AValue: TControlChildSizing);
+begin
+  if (FChildSizing=AValue) then exit;
+  FChildSizing.Assign(AValue);
+end;
+
+procedure TBGRACustomCtrl.SetColor(Value: TColor);
+begin
+  if inherited Color <> Value then
+  begin
+    inherited Color := Value;
+    ParentColor := False;
+    Perform(CM_COLORCHANGED, 0, 0);
+    Invalidate;
+  end;
+end;
+
+function TBGRACustomCtrl.GetColor : TColor;
+begin
+  Result := inherited Color;
+end;
+
+procedure TBGRACustomCtrl.UTF8KeyPress(var UTF8Key: {$IFDEF FPC}TUTF8Char{$ELSE}String{$ENDIF});
+begin
+end;
+
+procedure TBGRACustomCtrl.EnableAutoSizing;
+begin
+end;
+
+function TBGRACustomCtrl.ColorIsStored: boolean;
+begin
+  Result := not ParentColor;
+end;
+
+procedure TBGRACustomCtrl.SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer);
+begin
+  {if (csLoading in ComponentState)
+  or ((Owner<>nil) and (csLoading in Owner.ComponentState)) then
+    exit;}
+  SetBounds(aLeft,aTop,aWidth,aHeight);
+//  DoOnResize;
+end;
+
+class function TBGRACustomCtrl.GetControlClassDefaultSize: TSize;
+begin
+  Result.CX := 75;
+  Result.CY := 50;
+end;
+
+procedure TBGRACustomCtrl.CMTextChanged(var Message: TMessage);
+begin
+  TextChanged;
+end;
+
+procedure TBGRACustomCtrl.CMMouseEnter(var Message: TMessage);
+begin
+  if FMouseInClient then
+    Exit;
+
+  FMouseInClient := True;
+
+  // broadcast to parents first
+  if Assigned(Parent) then
+    Parent.Perform(CM_MOUSEENTER, 0, LParam(Self));
+
+  // if it is not a child message then perform an event
+  if (Message.LParam = 0) then
+    MouseEnter;
+end;
+
+procedure TBGRACustomCtrl.CMMouseLeave(var Message: TMessage);
+begin
+  if not FMouseInClient then
+    Exit;
+
+  FMouseInClient := False;
+
+  // broadcast to parents first
+  if Assigned(Parent) then
+    Parent.Perform(CM_MOUSELEAVE, 0, LParam(Self));
+
+  // if it is not a child message then perform an event
+  if (Message.LParam = 0) then
+    MouseLeave;
+end;
+
+{TBGRACustomPanel}
+
+constructor TBGRACustomPanel.Create(TheOwner: TComponent);
+begin
+  inherited Create(TheOwner);
+  FBorderSpacing := CreateControlBorderSpacing;
+  FChildSizing:=TControlChildSizing.Create(Self);
+  FChildSizing.OnChange := DoChildSizingChange;
+  FOnChange := Font.OnChange;
+  Font.OnChange := FontChanged;
+end;
+
+function TBGRACustomPanel.CreateControlBorderSpacing: TControlBorderSpacing;
+begin
+  Result := TControlBorderSpacing.Create(Self);
+end;
+
+destructor TBGRACustomPanel.Destroy;
+begin
+  FreeAndNil(FBorderSpacing);
+  FreeAndNil(FChildSizing);
+  inherited;
+end;
+
+procedure TBGRACustomPanel.DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean);
+var
+  IParent : ILCLControl;
+begin
+  if Parent <> nil then
+    if Supports(Parent, ILCLControl, IParent) then
+       IParent.InvalidatePreferredSize;
+  AdjustSize;
+end;
+
+procedure TBGRACustomPanel.DoChildSizingChange(Sender: TObject);
+begin
+  //debugln('TWinControl.DoChildSizingChange ',DbgSName(Self));
+  if ControlCount=0 then exit;
+  InvalidatePreferredSize;
+  ReAlign;
+end;
+
+procedure TBGRACustomPanel.DoOnResize;
+begin
+  if Assigned(OnResize) then
+    OnResize(Self);
+end;
+
+procedure TBGRACustomPanel.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;{%H-}WithThemeSpace: boolean);
+begin
+  PreferredWidth:=0;
+  PreferredHeight:=0;
+end;
+
+procedure TBGRACustomPanel.MouseEnter;
+begin
+  if Assigned(OnMouseEnter) then
+    OnMouseEnter(Self);
+end;
+
+procedure TBGRACustomPanel.MouseLeave;
+begin
+  if Assigned(OnMouseLeave) then
+    OnMouseLeave(Self);
+end;
+
+procedure TBGRACustomPanel.TextChanged;
+begin
+  // overrided;
+end;
+
+procedure TBGRACustomPanel.FontChanged(Sender: TObject);
+begin
+  ParentFont := False;
+  DesktopFont := False;
+  Invalidate;
+  Perform(CM_FONTCHANGED, 0, 0);
+  if AutoSize then
+  begin
+    InvalidatePreferredSize;
+    AdjustSize;
+  end;
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+function TBGRACustomPanel.GetDefaultDockCaption: String;
+begin
+end;
+
+function TBGRACustomPanel.GetInstance: TObject;
+begin
+  result := Self;
+end;
+
+function TBGRACustomPanel.RealGetText: TCaption;
+begin
+  Result := Caption;
+end;
+
+procedure TBGRACustomPanel.RealSetText(const Value: TCaption);
+begin
+  if RealGetText = Value then Exit;
+  Caption := Value;
+  Perform(CM_TEXTCHANGED, 0, 0);
+end;
+
+procedure TBGRACustomPanel.EnabledChanged;
+begin
+end;
+
+procedure TBGRACustomPanel.InvalidatePreferredSize;
+begin
+//  Invalidate;
+end;
+
+function TBGRACustomPanel.IsInnerBorderStored: boolean;
+begin
+  Result:=BorderSpacing.InnerBorder<>0;
+end;
+
+procedure TBGRACustomPanel.Resize;
+begin
+  inherited;
+  Invalidate;
+  DoOnResize;
+end;
+
+procedure TBGRACustomPanel.SetBorderSpacing(const AValue: TControlBorderSpacing);
+begin
+  if FBorderSpacing=AValue then exit;
+  FBorderSpacing.Assign(AValue);
+end;
+
+procedure TBGRACustomPanel.SetChildSizing(const AValue: TControlChildSizing);
+begin
+  if (FChildSizing=AValue) then exit;
+  FChildSizing.Assign(AValue);
+end;
+
+procedure TBGRACustomPanel.SetColor(Value: TColor);
+begin
+  if inherited Color <> Value then
+  begin
+    inherited Color := Value;
+    ParentColor := False;
+    Perform(CM_COLORCHANGED, 0, 0);
+    Invalidate;
+  end;
+end;
+
+function TBGRACustomPanel.GetColor : TColor;
+begin
+  Result := inherited Color;
+end;
+
+procedure TBGRACustomPanel.UTF8KeyPress(var UTF8Key: {$IFDEF FPC}TUTF8Char{$ELSE}String{$ENDIF});
+begin
+end;
+
+procedure TBGRACustomPanel.EnableAutoSizing;
+begin
+end;
+
+function TBGRACustomPanel.ColorIsStored: boolean;
+begin
+  Result := not ParentColor;
+end;
+
+procedure TBGRACustomPanel.SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer);
+begin
+  {if (csLoading in ComponentState)
+  or ((Owner<>nil) and (csLoading in Owner.ComponentState)) then
+    exit;}
+  SetBounds(aLeft,aTop,aWidth,aHeight);
+//  DoOnResize;
+end;
+
+class function TBGRACustomPanel.GetControlClassDefaultSize: TSize;
+begin
+  Result.CX := 75;
+  Result.CY := 50;
+end;
+
+procedure TBGRACustomPanel.CMTextChanged(var Message: TMessage);
+begin
+  TextChanged;
+end;
+
+procedure TBGRACustomPanel.CMMouseEnter(var Message: TMessage);
+begin
+  if FMouseInClient then
+    Exit;
+
+  FMouseInClient := True;
+
+  // broadcast to parents first
+  if Assigned(Parent) then
+    Parent.Perform(CM_MOUSEENTER, 0, LParam(Self));
+
+  // if it is not a child message then perform an event
+  if (Message.LParam = 0) then
+    MouseEnter;
+end;
+
+procedure TBGRACustomPanel.CMMouseLeave(var Message: TMessage);
+begin
+  if not FMouseInClient then
+    Exit;
+
+  FMouseInClient := False;
+
+  // broadcast to parents first
+  if Assigned(Parent) then
+    Parent.Perform(CM_MOUSELEAVE, 0, LParam(Self));
+
+  // if it is not a child message then perform an event
+  if (Message.LParam = 0) then
+    MouseLeave;
+end;
+
+{$ENDIF}
+
+{$IFNDEF FPC}
+
+{ TControlBorderSpacing }
+
+procedure TControlBorderSpacing.SetAround(const AValue: TSpacingSize);
+begin
+  if FAround=AValue then exit;
+  FAround:=AValue;
+  Change(false);
+end;
+
+function TControlBorderSpacing.IsAroundStored: boolean;
+begin
+  if FDefault = nil
+  then Result := FAround <> 0
+  else Result := FAround <> FDefault^.Around;
+end;
+
+function TControlBorderSpacing.IsBottomStored: boolean;
+begin
+  if FDefault = nil
+  then Result := FBottom <> 0
+  else Result := FBottom <> FDefault^.Bottom;
+end;
+
+function TControlBorderSpacing.IsInnerBorderStored: boolean;
+begin
+  if Control <> nil then
+    Result:=Control.IsInnerBorderStored
+  else
+    Result:=True;
+end;
+
+function TControlBorderSpacing.IsLeftStored: boolean;
+begin
+  if FDefault = nil
+  then Result := FLeft <> 0
+  else Result := FLeft <> FDefault^.Left;
+end;
+
+function TControlBorderSpacing.IsRightStored: boolean;
+begin
+  if FDefault = nil
+  then Result := FRight <> 0
+  else Result := FRight <> FDefault^.Right;
+end;
+
+function TControlBorderSpacing.IsTopStored: boolean;
+begin
+  if FDefault = nil
+  then Result := FTop <> 0
+  else Result := FTop <> FDefault^.Top;
+end;
+
+procedure TControlBorderSpacing.SetBottom(const AValue: TSpacingSize);
+begin
+  if FBottom=AValue then exit;
+  FBottom:=AValue;
+  Change(false);
+end;
+
+procedure TControlBorderSpacing.SetCellAlignHorizontal(
+  const AValue: TControlCellAlign);
+begin
+  if FCellAlignHorizontal=AValue then exit;
+  FCellAlignHorizontal:=AValue;
+  Change(false);
+end;
+
+procedure TControlBorderSpacing.SetCellAlignVertical(
+  const AValue: TControlCellAlign);
+begin
+  if FCellAlignVertical=AValue then exit;
+  FCellAlignVertical:=AValue;
+  Change(false);
+end;
+
+procedure TControlBorderSpacing.SetInnerBorder(const AValue: Integer);
+begin
+  if FInnerBorder=AValue then exit;
+  FInnerBorder:=AValue;
+  if Control<>nil then Control.InvalidatePreferredSize;
+  Change(true);
+end;
+
+procedure TControlBorderSpacing.SetLeft(const AValue: TSpacingSize);
+begin
+  if FLeft=AValue then exit;
+  FLeft:=AValue;
+  Change(false);
+end;
+
+procedure TControlBorderSpacing.SetRight(const AValue: TSpacingSize);
+begin
+  if FRight=AValue then exit;
+  FRight:=AValue;
+  Change(false);
+end;
+
+procedure TControlBorderSpacing.SetSpace(Kind: TAnchorKind;
+  const AValue: integer);
+begin
+  case Kind of
+  akLeft: Left:=AValue;
+  akTop: Top:=AValue;
+  akBottom: Bottom:=AValue;
+  akRight: Right:=AValue;
+  end;
+end;
+
+procedure TControlBorderSpacing.SetTop(const AValue: TSpacingSize);
+begin
+  if FTop=AValue then exit;
+  FTop:=AValue;
+  Change(false);
+end;
+
+constructor TControlBorderSpacing.Create(OwnerControl: ILCLControl; ADefault: PControlBorderSpacingDefault);
+begin
+  FControl := OwnerControl;
+  FDefault := ADefault;
+  if ADefault <> nil then
+  begin
+    FLeft := ADefault^.Left;
+    FRight := ADefault^.Right;
+    FTop := ADefault^.Top;
+    FBottom := ADefault^.Bottom;
+    FAround := ADefault^.Around;
+  end;
+  FCellAlignHorizontal := ccaFill;
+  FCellAlignVertical := ccaFill;
+  inherited Create;
+end;
+
+procedure TControlBorderSpacing.Assign(Source: TPersistent);
+var
+  SrcSpacing: TControlBorderSpacing;
+begin
+  if Source is TControlBorderSpacing then begin
+    SrcSpacing:=TControlBorderSpacing(Source);
+    if IsEqual(SrcSpacing) then exit;
+
+    FAround:=SrcSpacing.Around;
+    FBottom:=SrcSpacing.Bottom;
+    FLeft:=SrcSpacing.Left;
+    FRight:=SrcSpacing.Right;
+    FTop:=SrcSpacing.Top;
+    FInnerBorder:=SrcSpacing.InnerBorder;
+    FCellAlignHorizontal:=SrcSpacing.CellAlignHorizontal;
+    FCellAlignVertical:=SrcSpacing.CellAlignVertical;
+
+    Change(false);
+  end else
+    inherited Assign(Source);
+end;
+
+procedure TControlBorderSpacing.AssignTo(Dest: TPersistent);
+begin
+  Dest.Assign(Self);
+end;
+
+procedure TControlBorderSpacing.AutoAdjustLayout(const AXProportion,
+  AYProportion: Double);
+
+  procedure Scale(var Value: Integer; const Proportion: Double; var Changed: Boolean);
+  begin
+    if Value<>0 then
+    begin
+      Value := Round(Value * Proportion);
+      Changed := True;
+    end;
+  end;
+var
+  InnerChanged, OuterChanged: Boolean;
+begin
+  InnerChanged := False;
+  OuterChanged := False;
+
+  Scale(FAround, AXProportion, OuterChanged);
+  Scale(FInnerBorder, AXProportion, InnerChanged);
+  Scale(FLeft, AXProportion, OuterChanged);
+  Scale(FTop, AYProportion, OuterChanged);
+  Scale(FRight, AXProportion, OuterChanged);
+  Scale(FBottom, AYProportion, OuterChanged);
+
+  if OuterChanged or InnerChanged then
+  begin
+    if Control<>nil then Control.InvalidatePreferredSize;
+    Change(InnerChanged);
+  end;
+end;
+
+function TControlBorderSpacing.IsEqual(Spacing: TControlBorderSpacing
+  ): boolean;
+begin
+  Result:=(FAround=Spacing.Around)
+      and (FBottom=Spacing.Bottom)
+      and (FLeft=Spacing.Left)
+      and (FRight=Spacing.Right)
+      and (FTop=Spacing.Top);
+end;
+
+procedure TControlBorderSpacing.GetSpaceAround(var SpaceAround: TRect);
+begin
+  SpaceAround.Left:=Left+Around;
+  SpaceAround.Top:=Top+Around;
+  SpaceAround.Right:=Right+Around;
+  SpaceAround.Bottom:=Bottom+Around;
+end;
+
+
+function TControlBorderSpacing.GetSideSpace(Kind: TAnchorKind): Integer;
+begin
+  Result:=Around+GetSpace(Kind);
+end;
+
+function TControlBorderSpacing.GetSpace(Kind: TAnchorKind): Integer;
+begin
+  case Kind of
+  akLeft: Result:=Left;
+  akTop: Result:=Top;
+  akRight: Result:=Right;
+  akBottom: Result:=Bottom;
+  end;
+end;
+
+procedure TControlBorderSpacing.Change(InnerSpaceChanged: Boolean);
+begin
+  if FControl <> nil then
+    FControl.DoBorderSpacingChange(Self,InnerSpaceChanged);
+  if Assigned(OnChange) then OnChange(Self);
+end;
+
+function TControlBorderSpacing.GetAroundBottom: Integer;
+begin
+  Result := Around+Bottom;
+end;
+
+function TControlBorderSpacing.GetAroundLeft: Integer;
+begin
+  Result := Around+Left;
+end;
+
+function TControlBorderSpacing.GetAroundRight: Integer;
+begin
+  Result := Around+Right;
+end;
+
+function TControlBorderSpacing.GetAroundTop: Integer;
+begin
+  Result := Around+Top;
+end;
+
+function TControlBorderSpacing.GetControlBottom: Integer;
+begin
+  if  (FControl<>nil) and (FControl.GetInstance<>nil) and FControl.GetInstance.InheritsFrom(TControl) then
+    Result := TControl(FControl.GetInstance).Top +TControl(FControl.GetInstance).Height +Around+Bottom
+  else
+    Result := 0;
+end;
+
+function TControlBorderSpacing.GetControlHeight: Integer;
+begin
+  if (FControl<>nil) and (FControl.GetInstance<>nil) and FControl.GetInstance.InheritsFrom(TControl) then
+    Result := TControl(FControl.GetInstance).Height+Around*2+Top+Bottom
+  else
+    Result := 0;
+end;
+
+function TControlBorderSpacing.GetControlLeft: Integer;
+begin
+  if  (FControl<>nil) and (FControl.GetInstance<>nil) and FControl.GetInstance.InheritsFrom(TControl) then
+    Result := TControl(FControl.GetInstance).Left-Around-Left
+  else
+    Result := 0;
+end;
+
+function TControlBorderSpacing.GetControlRight: Integer;
+begin
+  if  (FControl<>nil) and (FControl.GetInstance<>nil) and FControl.GetInstance.InheritsFrom(TControl) then
+    Result := TControl(FControl.GetInstance).Left+TControl(FControl.GetInstance).Width+Around+Right
+  else
+    Result := 0;
+end;
+
+function TControlBorderSpacing.GetControlTop: Integer;
+begin
+  if (FControl<>nil) and (FControl.GetInstance<>nil) and FControl.GetInstance.InheritsFrom(TControl) then
+    Result := TControl(FControl.GetInstance).Top-Around-Top
+  else
+    Result := 0;
+end;
+
+function TControlBorderSpacing.GetControlWidth: Integer;
+begin
+  if (FControl<>nil) and (FControl.GetInstance<>nil) and FControl.GetInstance.InheritsFrom(TControl) then
+    Result := TControl(FControl.GetInstance).Width+Around*2+Left+Right
+  else
+    Result := 0;
+end;
+
+{ TControlChildSizing }
+
+procedure TControlChildSizing.SetEnlargeHorizontal(
+  const AValue: TChildControlResizeStyle);
+begin
+  if FEnlargeHorizontal=AValue then exit;
+  FEnlargeHorizontal:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetControlsPerLine(const AValue: integer);
+begin
+  if FControlsPerLine=AValue then exit;
+  FControlsPerLine:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetEnlargeVertical(
+  const AValue: TChildControlResizeStyle);
+begin
+  if FEnlargeVertical=AValue then exit;
+  FEnlargeVertical:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetHorizontalSpacing(const AValue: integer);
+begin
+  if FHorizontalSpacing=AValue then exit;
+  FHorizontalSpacing:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetLayout(const AValue: TControlChildrenLayout);
+begin
+  if FLayout=AValue then exit;
+  FLayout:=AValue;
+  //debugln('TControlChildSizing.SetLayout ',DbgSName(Control));
+  Change;
+end;
+
+procedure TControlChildSizing.SetLeftRightSpacing(const AValue: integer);
+begin
+  if FLeftRightSpacing=AValue then exit;
+  FLeftRightSpacing:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetShrinkHorizontal(
+  const AValue: TChildControlResizeStyle);
+begin
+  if FShrinkHorizontal=AValue then exit;
+  FShrinkHorizontal:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetShrinkVertical(
+  const AValue: TChildControlResizeStyle);
+begin
+  if FShrinkVertical=AValue then exit;
+  FShrinkVertical:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetTopBottomSpacing(const AValue: integer);
+begin
+  if FTopBottomSpacing=AValue then exit;
+  FTopBottomSpacing:=AValue;
+  Change;
+end;
+
+procedure TControlChildSizing.SetVerticalSpacing(const AValue: integer);
+begin
+  if FVerticalSpacing=AValue then exit;
+  FVerticalSpacing:=AValue;
+  Change;
+end;
+
+constructor TControlChildSizing.Create(OwnerControl: ILCLControl);
+begin
+  inherited Create;
+  FControl := OwnerControl;
+  FLayout := cclNone;
+  FEnlargeHorizontal :=crsAnchorAligning;
+  FEnlargeVertical := crsAnchorAligning;
+  FShrinkHorizontal := crsAnchorAligning;
+  FShrinkVertical := crsAnchorAligning;
+end;
+
+procedure TControlChildSizing.Assign(Source: TPersistent);
+var
+  SrcSizing: TControlChildSizing;
+begin
+  if Source is TControlChildSizing then begin
+    SrcSizing:=TControlChildSizing(Source);
+    if IsEqual(SrcSizing) then exit;
+
+    FEnlargeHorizontal:=SrcSizing.EnlargeHorizontal;
+    FEnlargeVertical:=SrcSizing.EnlargeVertical;
+    FShrinkHorizontal:=SrcSizing.ShrinkHorizontal;
+    FShrinkVertical:=SrcSizing.ShrinkVertical;
+    FEnlargeHorizontal:=SrcSizing.EnlargeHorizontal;
+    FEnlargeVertical:=SrcSizing.EnlargeVertical;
+    FShrinkHorizontal:=SrcSizing.ShrinkHorizontal;
+    FShrinkVertical:=SrcSizing.ShrinkVertical;
+    FControlsPerLine:=SrcSizing.ControlsPerLine;
+    FLayout:=SrcSizing.Layout;
+    FLeftRightSpacing:=SrcSizing.LeftRightSpacing;
+    FTopBottomSpacing:=SrcSizing.TopBottomSpacing;
+    FHorizontalSpacing:=SrcSizing.HorizontalSpacing;
+    FVerticalSpacing:=SrcSizing.VerticalSpacing;
+
+    Change;
+  end else
+    inherited Assign(Source);
+end;
+
+procedure TControlChildSizing.AssignTo(Dest: TPersistent);
+begin
+  Dest.Assign(Self);
+end;
+
+function TControlChildSizing.IsEqual(Sizing: TControlChildSizing): boolean;
+begin
+  Result:=(FEnlargeHorizontal=Sizing.EnlargeHorizontal)
+      and (FEnlargeVertical=Sizing.EnlargeVertical)
+      and (FShrinkHorizontal=Sizing.ShrinkHorizontal)
+      and (FShrinkVertical=Sizing.ShrinkVertical)
+      and (FEnlargeHorizontal=Sizing.EnlargeHorizontal)
+      and (FEnlargeVertical=Sizing.EnlargeVertical)
+      and (FShrinkHorizontal=Sizing.ShrinkHorizontal)
+      and (FShrinkVertical=Sizing.ShrinkVertical)
+      and (FControlsPerLine=Sizing.ControlsPerLine)
+      and (FLayout=Sizing.Layout)
+      and (FLeftRightSpacing=Sizing.LeftRightSpacing)
+      and (FTopBottomSpacing=Sizing.TopBottomSpacing)
+      and (FHorizontalSpacing=Sizing.HorizontalSpacing)
+      and (FVerticalSpacing=Sizing.VerticalSpacing);
+end;
+
+procedure TControlChildSizing.SetGridSpacing(Spacing: integer);
+begin
+  if (LeftRightSpacing=Spacing)
+  and (TopBottomSpacing=Spacing)
+  and (HorizontalSpacing=Spacing)
+  and (VerticalSpacing=Spacing) then exit;
+  fLeftRightSpacing:=Spacing;
+  fTopBottomSpacing:=Spacing;
+  fHorizontalSpacing:=Spacing;
+  fVerticalSpacing:=Spacing;
+  Change;
+end;
+
+procedure TControlChildSizing.Change;
+begin
+  if (FControl<>nil) and (FControl.GetInstance<>nil) and FControl.GetInstance.InheritsFrom(TBGRACustomCtrl) then
+    TBGRACustomCtrl(FControl.GetInstance).DoChildSizingChange(Self);
+  if Assigned(FOnChange) then
+   FOnChange(Self);
+end;
+
+{$ENDIF}
+
 end.
 

+ 8 - 2
bcbrightandcontrast.pas

@@ -1,13 +1,19 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+
 unit BCBrightAndContrast;
 
 { Unit contributed by esvignolo }
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, Graphics, LCLType;
+  Classes, SysUtils, Graphics,{$IFDEF FPC}LCLType{$ELSE}Types, BGRAGraphics, GraphType, FPImage{$ENDIF};
 
 function Bright(aColor: TColor; BrightPercent: byte): TColor;
 function GetContrastColor(ABGColor: TColor): TColor;

+ 94 - 45
bcbutton.pas

@@ -39,17 +39,24 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+
 unit BCButton;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, LResources, Controls, Dialogs, BGRABitmap, BGRABitmapTypes,
+  Classes, types, {$IFDEF FPC}LCLType, LResources, LMessages,{$ENDIF} Controls, Dialogs,
   ActnList, ImgList, Menus, // MORA
-  Buttons, Graphics, LCLType, types, BCTypes, Forms, BCBasectrls,
-  BCThemeManager;
+  Buttons, Graphics,
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BGRABitmap, BGRABitmapTypes, BCThemeManager, BCTypes, Forms, BCBasectrls;
 
 {off $DEFINE DEBUG}
 
@@ -98,7 +105,7 @@ type
   TCustomBCButton = class(TBCStyleGraphicControl)
   private
     { Private declarations }
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     FRenderCount: integer;
     {$ENDIF}
     FDropDownArrowSize: integer;
@@ -174,6 +181,7 @@ type
     procedure OnChangeGlyph({%H-}Sender: TObject);
     procedure OnChangeState({%H-}Sender: TObject; AData: PtrInt);
     procedure ImageListChange(ASender: TObject);
+    function  GetGlyph: TBitmap;
   protected
     { Protected declarations }
     procedure LimitMemoryUsage;
@@ -184,11 +192,11 @@ type
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
       X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
-    procedure MouseEnter; override;
-    procedure MouseLeave; override;
+    procedure MouseEnter;  override;
+    procedure MouseLeave;  override;
     procedure MouseMove(Shift: TShiftState; X, Y: integer); override;
     procedure SetEnabled(Value: boolean); override;
-    procedure TextChanged; override;
+    procedure TextChanged;  override;
   protected
     // MORA
     procedure ActionChange(Sender: TObject; CheckDefaults: boolean); override;
@@ -210,7 +218,7 @@ type
     property ImageIndex: integer read FImageIndex write SetImageIndex default -1;
     property ShowCaption: boolean read FShowCaption write SetShowCaption default True;
   protected
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     function GetDebugText: string; override;
     {$ENDIF}
     function GetStyleExtension: string; override;
@@ -228,7 +236,7 @@ type
     property DropDownArrowSize: integer read FDropDownArrowSize
       write SetDropDownArrowSize;
     property FlipArrow: boolean read FFlipArrow write SetFlipArrow default False;
-    property Glyph: TBitmap read FGlyph write SetGlyph;
+    property Glyph: TBitmap read GetGlyph write SetGlyph;
     property GlyphMargin: integer read FGlyphMargin write SetGlyphMargin default 5;
     property Style: TBCButtonStyle read FStyle write SetStyle default bbtButton;
     property StaticButton: boolean
@@ -258,13 +266,15 @@ type
     { Called by EndUpdate }
     procedure UpdateControl; override;
   public
+    {$IFDEF FPC}
     { Save all published settings to file }
-    procedure SaveToFile(AFileName: string);
+    procedure SaveToFile(AFileName: string); override;
     { Load and assign all published settings from file }
-    procedure LoadFromFile(AFileName: string);
+    procedure LoadFromFile(AFileName: string); override;
     { Assign the properties from AFileName to this instance }
-    procedure AssignFromFile(AFileName: string);
+    procedure AssignFromFile(AFileName: string); override;
     { Used by SaveToFile/LoadFromFile }
+    {$ENDIF}
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
   end;
@@ -371,17 +381,19 @@ type
     function IsImageIndexLinked: boolean; override;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses LCLIntf, Math, LCLProc, BCTools, SysUtils, PropEdits, GraphPropEdits;
+uses {$IFDEF FPC}LCLIntf, PropEdits, GraphPropEdits, LCLProc, {$ENDIF}Math, BCTools, SysUtils;
 
+{$IFDEF FPC}//#
 type
   TBCButtonImageIndexPropertyEditor = class(TImageIndexPropertyEditor)
   protected
     function GetImageList: TCustomImageList; override;
   end;
+{$ENDIF}
 
 { TBCButton }
 
@@ -391,6 +403,7 @@ begin
   FBCThemeManager:=AValue;
 end;
 
+{$IFDEF FPC}//#
 function TBCButtonImageIndexPropertyEditor.GetImageList: TCustomImageList;
 var
   Component: TPersistent;
@@ -401,15 +414,18 @@ begin
   else
     Result := nil;
 end;
+{$ENDIF}
 
+{$IFDEF FPC}
 procedure Register;
 begin
   {$I images\bgracontrols_images.lrs}
   //{$I icons\bcbutton_icon.lrs}
-  RegisterComponents('BGRA Button Controls', [TBCButton]);
+  RegisterComponents('BGRA Controls', [TBCButton]);
   RegisterPropertyEditor(TypeInfo(integer), TBCButton,
     'ImageIndex', TBCButtonImageIndexPropertyEditor);
 end;
+{$ENDIF}
 
 { TBCButtonActionLink }
 
@@ -488,9 +504,9 @@ begin
   FBorder := TBCBorder.Create(AControl);
   FFontEx := TBCFont.Create(AControl);
 
-  FBackground.OnChange := @OnChangeChildProperty;
-  FBorder.OnChange := @OnChangeChildProperty;
-  FFontEx.OnChange := @OnChangeFont;
+  FBackground.OnChange := OnChangeChildProperty;
+  FBorder.OnChange := OnChangeChildProperty;
+  FFontEx.OnChange := OnChangeFont;
 
   inherited Create(AControl);
 end;
@@ -644,7 +660,7 @@ end;
 
 procedure TCustomBCButton.RenderAll(ANow: boolean);
 begin
-  if (csCreating in FControlState) or IsUpdating or (FBGRANormal = nil) then
+  if (csCreating in ControlState) or IsUpdating or (FBGRANormal = nil) then
     Exit;
 
   if ANow then
@@ -679,6 +695,11 @@ begin
   Result := FDropDownWidth + (ifthen(AFull, 2, 1) * FStateNormal.FBorder.Width);
 end;
 
+function TCustomBCButton.GetGlyph: TBitmap;
+begin
+  Result := FGlyph as TBitmap;
+end;
+
 function TCustomBCButton.GetDropDownRect(AFull: boolean): TRect;
 begin
   Result := GetClientRect;
@@ -709,7 +730,11 @@ var
     if Assigned(FImages) and (FImageIndex > -1) and (FImageIndex < FImages.Count) then
     begin
       bitmap := TBitmap.Create;
+      {$IFDEF FPC}
       FImages.GetBitmap(FImageIndex, bitmap);
+      {$ELSE}
+      FImages.GetBitmapRaw(FImageIndex, bitmap);
+      {$ENDIF}
     end
     else
       bitmap := nil;
@@ -734,7 +759,7 @@ var
   end;
 
 begin
-  if (csCreating in FControlState) or IsUpdating then
+  if (csCreating in ControlState) or IsUpdating then
     Exit;
 
   ABGRA.NeedRender := False;
@@ -821,8 +846,8 @@ begin
   if Assigned(FOnAfterRenderBCButton) then
     FOnAfterRenderBCButton(Self, ABGRA, AState, r);
 
-  {$IFDEF DEBUG}
-  FRenderCount += 1;
+  {$IFDEF INDEBUG}
+  FRenderCount := FRenderCount +1;
   {$ENDIF}
 end;
 
@@ -859,6 +884,11 @@ end;
 
 procedure TCustomBCButton.LimitMemoryUsage;
 begin
+  {$IFNDEF FPC}//# //@  IN DELPHI NEEDRENDER NEDD TO BE TRUE. IF FALSE COMPONENT IN BGRANORMAL BE BLACK AFTER INVALIDATE.
+  if Assigned(FBGRAHover) then FBGRANormal.NeedRender := True;
+  if Assigned(FBGRAHover) then FBGRAHover.NeedRender := True;
+  if Assigned(FBGRAClick) then FBGRAClick.NeedRender := True;
+  {$ENDIF}
   if (FMemoryUsage = bmuLow) and Assigned(FBGRANormal) then FBGRANormal.Discard;
   if (FMemoryUsage <> bmuHigh) then
   begin
@@ -1090,9 +1120,12 @@ procedure TCustomBCButton.CalculatePreferredSize(
   var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean);
 var
 //  AWidth: integer;
-  gh: integer = 0;
-  gw: integer = 0;
+  gh: integer;
+  gw: integer;
 begin
+  gh:= 0;
+  gw:= 0;
+
   if (Parent = nil) or (not Parent.HandleAllocated) then
     Exit;
 {  if WidthIsAnchored then
@@ -1159,15 +1192,18 @@ procedure TCustomBCButton.DropDownClosed(Sender: TObject);
 begin
   if Assigned(FSaveDropDownClosed) then
     FSaveDropDownClosed(Sender);
+  {$IFDEF FPC}//#
   if Assigned(FDropDownMenu) then
     FDropDownMenu.OnClose := FSaveDropDownClosed;
-
+  {$ENDIF}
   // MORA: DropDownMenu is still visible if mouse is over control
-  FDropDownMenuVisible := PtInRect(ClientRect, ScreenToClient(Mouse.CursorPos));
+  FDropDownMenuVisible := {$IFNDEF FPC}BGRAGraphics.{$ENDIF}PtInRect(ClientRect, ScreenToClient(Mouse.CursorPos));
 end;
 
 procedure TCustomBCButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
   X, Y: integer);
+var
+ ClientToScreenPoint : TPoint;
 begin
   inherited MouseDown(Button, Shift, X, Y);
   if csDesigning in ComponentState then
@@ -1207,14 +1243,16 @@ begin
     else
     if ((FActiveButt = bbtDropDown) or (FStyle = bbtButton)) and
       (FDropDownMenu <> nil) and Enabled then
-      with ClientToScreen(Point(0, Height)) do
+    begin
+      ClientToScreenPoint := ClientToScreen(Point(0, Height));
+      with ClientToScreenPoint do
       begin
         // normal button
         if FStyle = bbtButton then
         begin
           x := x + Width * integer(FDropDownMenu.Alignment = paRight);
           if FFlipArrow then
-            y -= Height;
+            y := y -Height;
         end
         else
           // dropdown button
@@ -1223,12 +1261,12 @@ begin
           begin
             x := x + Width * integer(FDropDownMenu.Alignment = paRight);
             if FFlipArrow then
-              y -= (FDropDownWidth + (FStateNormal.FBorder.Width * 2));
+              y := y -(FDropDownWidth + (FStateNormal.FBorder.Width * 2));
           end
           else
           begin
             if FFlipArrow then
-              y -= Height;
+              y := y -Height;
             if FDropDownStyle = bdsSeparate then
               x := x + Width - (FDropDownWidth + (FStateNormal.FBorder.Width * 2)) *
                 integer(FDropDownMenu.Alignment <> paRight)
@@ -1238,10 +1276,13 @@ begin
         end;
 
         FDropDownMenuVisible := True;
+        {$IFDEF FPC}//#
         FSaveDropDownClosed := FDropDownMenu.OnClose;
-        FDropDownMenu.OnClose := @DropDownClosed;
+        FDropDownMenu.OnClose := DropDownClosed;
+        {$ENDIF}
         FDropDownMenu.PopUp(x, y);
       end;
+    end;
   end;
 end;
 
@@ -1447,7 +1488,7 @@ begin
   RenderControl;
   inherited UpdateControl; // indalidate
 end;
-
+{$IFDEF FPC}//#
 procedure TCustomBCButton.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -1468,7 +1509,7 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
@@ -1483,13 +1524,14 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(AButton), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(AButton), OnFindClass);
     Assign(AButton);
   finally
     AStream.Free;
     AButton.Free;
   end;
 end;
+{$ENDIF}
 
 procedure TCustomBCButton.OnFindClass(Reader: TReader; const AClassName: string;
   var ComponentClass: TComponentClass);
@@ -1498,7 +1540,7 @@ begin
     ComponentClass := TBCButton;
 end;
 
-{$IFDEF DEBUG}
+{$IFDEF INDEBUG}
 function TCustomBCButton.GetDebugText: string;
 begin
   Result := 'R: ' + IntToStr(FRenderCount);
@@ -1624,12 +1666,16 @@ end;
 constructor TCustomBCButton.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FRenderCount := 0;
   {$ENDIF}
   FMemoryUsage := bmuHigh;
+  {$IFDEF FPC}
   DisableAutoSizing;
   Include(FControlState, csCreating);
+  {$ELSE} //#
+
+  {$ENDIF}
   //{$IFDEF WINDOWS}
   // default sizes under different dpi settings
   //SetSizeVariables(ScaleX(8,96), ScaleX(16,96), ScaleY(8,96), ScaleX(24,96));
@@ -1652,15 +1698,15 @@ begin
     FStateNormal := TBCButtonState.Create(Self);
     FStateHover := TBCButtonState.Create(Self);
     FStateClicked := TBCButtonState.Create(Self);
-    FStateNormal.OnChange := @OnChangeState;
-    FStateHover.OnChange := @OnChangeState;
-    FStateClicked.OnChange := @OnChangeState;
+    FStateNormal.OnChange := OnChangeState;
+    FStateHover.OnChange := OnChangeState;
+    FStateClicked.OnChange := OnChangeState;
 
     FRounding := TBCRounding.Create(Self);
-    FRounding.OnChange := @OnChangeState;
+    FRounding.OnChange := OnChangeState;
 
     FRoundingDropDown := TBCRounding.Create(Self);
-    FRoundingDropDown.OnChange := @OnChangeState;
+    FRoundingDropDown.OnChange := OnChangeState;
 
     { Connecting bitmaps with states property to easy call and access }
     FBGRANormal.CustomData := PtrInt(FStateNormal);
@@ -1671,7 +1717,7 @@ begin
     FDownButtonState := msNone;
     FFlipArrow := False;
     FGlyph := TBitmap.Create;
-    FGlyph.OnChange := @OnChangeGlyph;
+    FGlyph.OnChange := OnChangeGlyph;
     FGlyphMargin := 5;
     FStyle := bbtButton;
     FStaticButton := False;
@@ -1685,14 +1731,17 @@ begin
     AssignDefaultStyle;
 
     FImageChangeLink := TChangeLink.Create;
-    FImageChangeLink.OnChange := @ImageListChange;
+    FImageChangeLink.OnChange := ImageListChange;
     FImageIndex := -1;
 
     FShowCaption := True;
     FPreserveGlyphOnAssign := True;
   finally
+    {$IFDEF FPC}
     Exclude(FControlState, csCreating);
     EnableAutoSizing;
+    {$ELSE} //#
+    {$ENDIF}
     EndUpdate;
   end;
 end;
@@ -1706,7 +1755,7 @@ begin
   FBGRANormal.Free;
   FBGRAHover.Free;
   FBGRAClick.Free;
-  FreeThenNil(FGlyph);
+  {$IFDEF FPC}FreeThenNil(FGlyph);{$ELSE}FreeAndNil(FGlyph);{$ENDIF}
   FRounding.Free;
   FRoundingDropDown.Free;
   inherited Destroy;

+ 106 - 50
bcbuttonfocus.pas

@@ -39,17 +39,23 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCButtonFocus;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, LResources, Controls, Dialogs, BGRABitmap, BGRABitmapTypes,
+  Classes, {$IFDEF FPC}LCLType, LResources, LMessages,{$ENDIF} Controls, Dialogs,
   ActnList, ImgList, Menus, // MORA
-  Buttons, Graphics, LCLType, types, BCTypes, Forms, BCBasectrls,
-  BCThemeManager, LMessages;
+  Buttons, Graphics, types,
+  {$IFNDEF FPC}Windows, Messages, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BGRABitmap, BGRABitmapTypes, BCTypes, Forms, BCBasectrls, BCThemeManager;
 
 {off $DEFINE DEBUG}
 
@@ -98,7 +104,7 @@ type
   TCustomBCButtonFocus = class(TBCStyleCustomControl)
   private
     { Private declarations }
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     FRenderCount: integer;
     {$ENDIF}
     FDropDownArrowSize: integer;
@@ -175,6 +181,7 @@ type
     procedure OnChangeGlyph({%H-}Sender: TObject);
     procedure OnChangeState({%H-}Sender: TObject; AData: PtrInt);
     procedure ImageListChange(ASender: TObject);
+    function GetGlyph: TBitmap;
   protected
     { Protected declarations }
     procedure LimitMemoryUsage;
@@ -213,15 +220,15 @@ type
     property ImageIndex: integer read FImageIndex write SetImageIndex default -1;
     property ShowCaption: boolean read FShowCaption write SetShowCaption default True;
   protected
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     function GetDebugText: string; override;
     {$ENDIF}
     function GetStyleExtension: string; override;
     procedure DrawControl; override;
     procedure RenderControl; override;
   protected
-    procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
-    procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
+    procedure WMSetFocus(var Message: {$IFDEF FPC}TLMSetFocus{$ELSE}TWMSetFocus{$ENDIF}); message {$IFDEF FPC}LM_SETFOCUS{$ELSE}WM_SETFOCUS{$ENDIF};
+    procedure WMKillFocus(var Message: {$IFDEF FPC}TLMKillFocus{$ELSE}TWMKillFocus{$ENDIF}); message {$IFDEF FPC}LM_KILLFOCUS{$ELSE}WM_KILLFOCUS{$ENDIF};
     procedure UpdateFocus(AFocused: boolean);
     property AutoSizeExtraVertical: integer read AutoSizeExtraY;
     property AutoSizeExtraHorizontal: integer read AutoSizeExtraX;
@@ -234,7 +241,7 @@ type
     property DropDownArrowSize: integer read FDropDownArrowSize
       write SetDropDownArrowSize;
     property FlipArrow: boolean read FFlipArrow write SetFlipArrow default False;
-    property Glyph: TBitmap read FGlyph write SetGlyph;
+    property Glyph: TBitmap read GetGlyph write SetGlyph;
     property GlyphMargin: integer read FGlyphMargin write SetGlyphMargin default 5;
     property Style: TBCButtonFocusStyle read FStyle write SetStyle default bbtButtonF;
     property StaticButton: boolean
@@ -265,12 +272,14 @@ type
     { Called by EndUpdate }
     procedure UpdateControl; override;
   public
+    {$IFDEF FPC}
     { Save all published settings to file }
     procedure SaveToFile(AFileName: string);
     { Load and assign all published settings from file }
     procedure LoadFromFile(AFileName: string);
     { Assign the properties from AFileName to this instance }
     procedure AssignFromFile(AFileName: string);
+    {$ENDIF}
     { Used by SaveToFile/LoadFromFile }
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
@@ -381,26 +390,19 @@ type
     function IsImageIndexLinked: boolean; override;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses LCLIntf, Math, LCLProc, BCTools, SysUtils, PropEdits, GraphPropEdits;
+uses {$IFDEF FPC}LCLIntf, PropEdits, LCLProc, GraphPropEdits,{$ENDIF} Math, BCTools, SysUtils;
 
+{$IFDEF FPC}
 type
   TBCButtonImageIndexPropertyEditor = class(TImageIndexPropertyEditor)
   protected
     function GetImageList: TCustomImageList; override;
   end;
 
-{ TBCButtonFocus }
-
-procedure TBCButtonFocus.SetFBCThemeManager(AValue: TBCThemeManager);
-begin
-  if FBCThemeManager=AValue then Exit;
-  FBCThemeManager:=AValue;
-end;
-
 function TBCButtonImageIndexPropertyEditor.GetImageList: TCustomImageList;
 var
   Component: TPersistent;
@@ -411,14 +413,26 @@ begin
   else
     Result := nil;
 end;
+{$ENDIF}
+
+{ TBCButtonFocus }
+procedure TBCButtonFocus.SetFBCThemeManager(AValue: TBCThemeManager);
+begin
+  if FBCThemeManager=AValue then Exit;
+  FBCThemeManager:=AValue;
+end;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bcbuttonfocus_icon.lrs}
-  RegisterComponents('BGRA Button Controls', [TBCButtonFocus]);
+  RegisterComponents('BGRA Controls', [TBCButtonFocus]);
+  {$IFDEF FPC}
   RegisterPropertyEditor(TypeInfo(integer), TBCButtonFocus,
     'ImageIndex', TBCButtonImageIndexPropertyEditor);
+  {$ENDIF}
 end;
+{$ENDIF}
 
 { TBCButtonFocusActionLink }
 
@@ -497,9 +511,9 @@ begin
   FBorder := TBCBorder.Create(AControl);
   FFontEx := TBCFont.Create(AControl);
 
-  FBackground.OnChange := @OnChangeChildProperty;
-  FBorder.OnChange := @OnChangeChildProperty;
-  FFontEx.OnChange := @OnChangeFont;
+  FBackground.OnChange := OnChangeChildProperty;
+  FBorder.OnChange := OnChangeChildProperty;
+  FFontEx.OnChange := OnChangeFont;
 
   inherited Create(AControl);
 end;
@@ -653,7 +667,7 @@ end;
 
 procedure TCustomBCButtonFocus.RenderAll(ANow: boolean);
 begin
-  if (csCreating in FControlState) or IsUpdating or (FBGRANormal = nil) then
+  if (csCreating in ControlState) or IsUpdating or (FBGRANormal = nil) then
     Exit;
 
   if ANow then
@@ -688,6 +702,11 @@ begin
   Result := FDropDownWidth + (ifthen(AFull, 2, 1) * FStateNormal.FBorder.Width);
 end;
 
+function TCustomBCButtonFocus.GetGlyph: TBitmap;
+begin
+  Result := FGlyph as TBitmap;
+end;
+
 function TCustomBCButtonFocus.GetDropDownRect(AFull: boolean): TRect;
 begin
   Result := GetClientRect;
@@ -719,7 +738,11 @@ var
     if Assigned(FImages) and (FImageIndex > -1) and (FImageIndex < FImages.Count) then
     begin
       bitmap := TBitmap.Create;
+      {$IFDEF FPC}
       FImages.GetBitmap(FImageIndex, bitmap);
+      {$ELSE}
+      FImages.GetBitmapRaw(FImageIndex, bitmap);
+      {$ENDIF}
     end
     else
       bitmap := nil;
@@ -746,7 +769,7 @@ var
   end;
 
 begin
-  if (csCreating in FControlState) or IsUpdating then
+  if (csCreating in ControlState) or IsUpdating then
     Exit;
 
   ABGRA.NeedRender := False;
@@ -833,8 +856,8 @@ begin
   if Assigned(FOnAfterRenderBCButton) then
     FOnAfterRenderBCButton(Self, ABGRA, AState, r);
 
-  {$IFDEF DEBUG}
-  FRenderCount += 1;
+  {$IFDEF INDEBUG}
+  FRenderCount := FRenderCount +1;
   {$ENDIF}
 end;
 
@@ -871,6 +894,11 @@ end;
 
 procedure TCustomBCButtonFocus.LimitMemoryUsage;
 begin
+  {$IFNDEF FPC}//# //@  IN DELPHI NEEDRENDER NEDD TO BE TRUE. IF FALSE COMPONENT IN BGRANORMAL BE BLACK AFTER INVALIDATE.
+  if Assigned(FBGRAHover) then FBGRANormal.NeedRender := True;
+  if Assigned(FBGRAHover) then FBGRAHover.NeedRender := True;
+  if Assigned(FBGRAClick) then FBGRAClick.NeedRender := True;
+  {$ENDIF}
   if (FMemoryUsage = bmuLowF) and Assigned(FBGRANormal) then FBGRANormal.Discard;
   if (FMemoryUsage <> bmuHighF) then
   begin
@@ -1102,9 +1130,11 @@ procedure TCustomBCButtonFocus.CalculatePreferredSize(
   var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean);
 var
 //  AWidth: integer;
-  gh: integer = 0;
-  gw: integer = 0;
+  gh: integer;
+  gw: integer;
 begin
+  gh := 0;
+  gw := 0;
   if (Parent = nil) or (not Parent.HandleAllocated) then
     Exit;
 {  if WidthIsAnchored then
@@ -1171,15 +1201,19 @@ procedure TCustomBCButtonFocus.DropDownClosed(Sender: TObject);
 begin
   if Assigned(FSaveDropDownClosed) then
     FSaveDropDownClosed(Sender);
+  {$IFDEF FPC}
   if Assigned(FDropDownMenu) then
     FDropDownMenu.OnClose := FSaveDropDownClosed;
+  {$ENDIF}
 
   // MORA: DropDownMenu is still visible if mouse is over control
-  FDropDownMenuVisible := PtInRect(ClientRect, ScreenToClient(Mouse.CursorPos));
+  FDropDownMenuVisible := {$IFNDEF FPC}BGRAGraphics.{$ENDIF}PtInRect(ClientRect, ScreenToClient(Mouse.CursorPos));
 end;
 
 procedure TCustomBCButtonFocus.MouseDown(Button: TMouseButton; Shift: TShiftState;
   X, Y: integer);
+var
+  ClientToScreenPoint : TPoint;
 begin
   inherited MouseDown(Button, Shift, X, Y);
   if csDesigning in ComponentState then
@@ -1221,14 +1255,16 @@ begin
     else
     if ((FActiveButt = bbtDropDownF) or (FStyle = bbtButtonF)) and
       (FDropDownMenu <> nil) and Enabled then
-      with ClientToScreen(Point(0, Height)) do
+    begin
+      ClientToScreenPoint := ClientToScreen(Point(0, Height));
+      with ClientToScreenPoint do
       begin
         // normal button
         if FStyle = bbtButtonF then
         begin
           x := x + Width * integer(FDropDownMenu.Alignment = paRight);
           if FFlipArrow then
-            y -= Height;
+            y := y -Height;
         end
         else
           // dropdown button
@@ -1237,12 +1273,12 @@ begin
           begin
             x := x + Width * integer(FDropDownMenu.Alignment = paRight);
             if FFlipArrow then
-              y -= (FDropDownWidth + (FStateNormal.FBorder.Width * 2));
+              y := y -(FDropDownWidth + (FStateNormal.FBorder.Width * 2));
           end
           else
           begin
             if FFlipArrow then
-              y -= Height;
+              y := y -Height;
             if FDropDownStyle = bdsSeparateF then
               x := x + Width - (FDropDownWidth + (FStateNormal.FBorder.Width * 2)) *
                 integer(FDropDownMenu.Alignment <> paRight)
@@ -1252,10 +1288,13 @@ begin
         end;
 
         FDropDownMenuVisible := True;
+        {$IFDEF FPC}
         FSaveDropDownClosed := FDropDownMenu.OnClose;
-        FDropDownMenu.OnClose := @DropDownClosed;
+        FDropDownMenu.OnClose := DropDownClosed;
+        {$ENDIF}
         FDropDownMenu.PopUp(x, y);
       end;
+    end;
   end;
 end;
 
@@ -1342,7 +1381,9 @@ begin
   // Old
   {FButtonState := msHover;
   Invalidate;}
+  {$IFDEF FPC}
   inherited MouseEnter;
+  {$ENDIF}
 end;
 
 procedure TCustomBCButtonFocus.MouseLeave;
@@ -1358,7 +1399,9 @@ begin
     FButtonState := msNone;
   FDownButtonState := msNone;
   Invalidate;
+  {$IFDEF FPC} //#
   inherited MouseLeave;
+  {$ENDIF}
 end;
 
 procedure TCustomBCButtonFocus.MouseMove(Shift: TShiftState; X, Y: integer);
@@ -1423,7 +1466,9 @@ end;
 
 procedure TCustomBCButtonFocus.TextChanged;
 begin
+  {$IFDEF FPC}
   inherited TextChanged;
+  {$ENDIF}
   RenderControl;
   UpdateSize;
   Invalidate;
@@ -1481,6 +1526,7 @@ begin
   inherited UpdateControl; // indalidate
 end;
 
+{$IFDEF FPC}
 procedure TCustomBCButtonFocus.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -1501,7 +1547,7 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
@@ -1516,13 +1562,14 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(AButton), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(AButton), OnFindClass);
     Assign(AButton);
   finally
     AStream.Free;
     AButton.Free;
   end;
 end;
+{$ENDIF}
 
 procedure TCustomBCButtonFocus.OnFindClass(Reader: TReader; const AClassName: string;
   var ComponentClass: TComponentClass);
@@ -1531,8 +1578,8 @@ begin
     ComponentClass := TBCButtonFocus;
 end;
 
-{$IFDEF DEBUG}
-function TCustomBCButton.GetDebugText: string;
+{$IFDEF INDEBUG}
+function TCustomBCButtonFocus.GetDebugText: string;
 begin
   Result := 'R: ' + IntToStr(FRenderCount);
 end;
@@ -1637,14 +1684,14 @@ begin
   RenderAll;
 end;
 
-procedure TCustomBCButtonFocus.WMSetFocus(var Message: TLMSetFocus);
+procedure TCustomBCButtonFocus.WMSetFocus(var Message: {$IFDEF FPC}TLMSetFocus{$ELSE}TWMSetFocus{$ENDIF});
 begin
   inherited;
 
   UpdateFocus(True);
 end;
 
-procedure TCustomBCButtonFocus.WMKillFocus(var Message: TLMKillFocus);
+procedure TCustomBCButtonFocus.WMKillFocus(var Message: {$IFDEF FPC}TLMKillFocus{$ELSE}TWMKillFocus{$ENDIF});
 begin
   inherited;
 
@@ -1660,10 +1707,12 @@ begin
   if lForm = nil then
     exit;
 
+  {$IFDEF FPC}//#
   if AFocused then
     ActiveDefaultControlChanged(lForm.ActiveControl)
   else
     ActiveDefaultControlChanged(nil);
+  {$ENDIF}
 
   Invalidate;
 end;
@@ -1691,12 +1740,16 @@ end;
 constructor TCustomBCButtonFocus.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FRenderCount := 0;
   {$ENDIF}
   FMemoryUsage := bmuHighF;
+  {$IFDEF FPC}
   DisableAutoSizing;
   Include(FControlState, csCreating);
+  {$ELSE} //#
+
+  {$ENDIF}
   //{$IFDEF WINDOWS}
   // default sizes under different dpi settings
   //SetSizeVariables(ScaleX(8,96), ScaleX(16,96), ScaleY(8,96), ScaleX(24,96));
@@ -1720,15 +1773,15 @@ begin
     FStateNormal := TBCButtonFocusState.Create(Self);
     FStateHover := TBCButtonFocusState.Create(Self);
     FStateClicked := TBCButtonFocusState.Create(Self);
-    FStateNormal.OnChange := @OnChangeState;
-    FStateHover.OnChange := @OnChangeState;
-    FStateClicked.OnChange := @OnChangeState;
+    FStateNormal.OnChange := OnChangeState;
+    FStateHover.OnChange := OnChangeState;
+    FStateClicked.OnChange := OnChangeState;
 
     FRounding := TBCRounding.Create(Self);
-    FRounding.OnChange := @OnChangeState;
+    FRounding.OnChange := OnChangeState;
 
     FRoundingDropDown := TBCRounding.Create(Self);
-    FRoundingDropDown.OnChange := @OnChangeState;
+    FRoundingDropDown.OnChange := OnChangeState;
 
     { Connecting bitmaps with states property to easy call and access }
     FBGRANormal.CustomData := PtrInt(FStateNormal);
@@ -1739,7 +1792,7 @@ begin
     FDownButtonState := msNone;
     FFlipArrow := False;
     FGlyph := TBitmap.Create;
-    FGlyph.OnChange := @OnChangeGlyph;
+    FGlyph.OnChange := OnChangeGlyph;
     FGlyphMargin := 5;
     FStyle := bbtButtonF;
     FStaticButton := False;
@@ -1753,14 +1806,17 @@ begin
     AssignDefaultStyle;
 
     FImageChangeLink := TChangeLink.Create;
-    FImageChangeLink.OnChange := @ImageListChange;
+    FImageChangeLink.OnChange := ImageListChange;
     FImageIndex := -1;
 
     FShowCaption := True;
     FPreserveGlyphOnAssign := True;
   finally
+    {$IFDEF FPC}
     Exclude(FControlState, csCreating);
     EnableAutoSizing;
+    {$ELSE} //#
+    {$ENDIF}
     EndUpdate;
   end;
 end;
@@ -1774,7 +1830,7 @@ begin
   FBGRANormal.Free;
   FBGRAHover.Free;
   FBGRAClick.Free;
-  FreeThenNil(FGlyph);
+  {$IFDEF FPC}FreeThenNil{$ELSE}FreeAndNil{$ENDIF}(FGlyph);
   FRounding.Free;
   FRoundingDropDown.Free;
   inherited Destroy;

+ 13 - 5
bcdefaultthememanager.pas

@@ -1,13 +1,20 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCDefaultThemeManager;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
+  Classes, SysUtils, {$IFDEF FPC}LResources, CustomDrawnDrawers,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
   BCButton, BCButtonFocus, BCNumericKeyboard, BCThemeManager,
-  BCSamples, CustomDrawnDrawers, BGRACustomDrawn, BCKeyboard;
+  BCSamples, {$IFDEF FPC}BGRACustomDrawn,{$ENDIF} BCKeyboard;
 
 type
 
@@ -38,14 +45,15 @@ type
     property CDStyle: TCDDrawStyle read FCDStyle write SetFCDStyle;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-procedure Register;
+{$IFDEF FPC}procedure Register;
 begin
   RegisterComponents('BGRA Controls', [TBCDefaultThemeManager]);
 end;
+{$ENDIF}
 
 { TBCDefaultThemeManager }
 

+ 13 - 6
bceffect.pas

@@ -33,15 +33,22 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCEffect;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
+{$IFDEF FPC}
 {$modeswitch advancedrecords}
+{$ENDIF}
 
 interface
 
 uses
-  Classes, SysUtils, LCLProc, BGRABitmapTypes, LazUTF8;
+  Classes, SysUtils, {$IFDEF FPC}LCLProc, LazUTF8, {$ELSE}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF} BGRABitmapTypes;
 
 {-- Fading --}
 
@@ -94,9 +101,9 @@ var
   fm: TFadingMode;
   ls: ansistring;
 begin
-  ls := UTF8LowerCase(s);
+  ls := {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(s);
   for fm := low(TFadingMode) to high(TFadingMode) do
-    if ls = UTF8LowerCase(FadingModeStr[fm]) then
+    if ls = {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(FadingModeStr[fm]) then
     begin
       Result := fm;
       break;
@@ -189,7 +196,7 @@ begin
           FMode := fmSuspended;
       end
       else
-        FAlpha += alphaStep*AStepCount;
+        FAlpha := FAlpha + (alphaStep*AStepCount);
     end;
     fmFadeOut,fmFadeOutIn, fmFadeOutCycle:
     begin
@@ -205,7 +212,7 @@ begin
           FMode := fmSuspended;
       end
       else
-        FAlpha -= alphaStep*AStepCount;
+        FAlpha := FAlpha - (alphaStep*AStepCount);
     end;
   end;
 

+ 19 - 14
bcfilters.pas

@@ -33,6 +33,11 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit bcfilters;
 
 {
@@ -72,12 +77,12 @@ begin
   Bitmap.InvalidateBitmap;
 }
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LCLProc, Math, BGRABitmap, BGRABitmapTypes, LazUTF8;
+  Classes, SysUtils, {$IFDEF FPC}LCLProc, LazUTF8,{$ELSE}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF} Math, BGRABitmap, BGRABitmapTypes;
 
 type
   TBCSimpleFilter = (bcsNone, bcsGameBoyDithering, bcsBlackAndWhiteDithering, bcsInvert,
@@ -135,14 +140,14 @@ procedure GGG(Bitmap: TBGRABitmap);
 procedure BBB(Bitmap: TBGRABitmap);
 
 { Invert colors, keep alpha }
-procedure Invert(Bitmap: TBGRABitmap);
+procedure Invert(Bitmap: TBGRABitmap); overload;
 { Invert colors, advanced options }
-procedure Invert(Bitmap: TBGRABitmap; touchR, touchG, touchB, touchA: boolean);
+procedure Invert(Bitmap: TBGRABitmap; touchR, touchG, touchB, touchA: boolean); overload;
 
 { GrayScale, keep alpha }
-procedure GrayScale(Bitmap: TBGRABitmap);
+procedure GrayScale(Bitmap: TBGRABitmap); overload;
 { GrayScale, keep alpha, pallete }
-procedure GrayScale(Bitmap: TBGRABitmap; pallete: byte);
+procedure GrayScale(Bitmap: TBGRABitmap; pallete: byte); overload;
 { GrayScale, alpha 255}
 procedure GrayScaleA(Bitmap: TBGRABitmap);
 { GrayScale, using BGRAToGrayScale }
@@ -156,17 +161,17 @@ procedure GameBoyDithering(Bitmap: TBGRABitmap);
 procedure BlackAndWhiteDithering(Bitmap: TBGRABitmap);
 
 { Noise random color, keep alpha }
-procedure Noise(Bitmap: TBGRABitmap);
+procedure Noise(Bitmap: TBGRABitmap); overload;
 { Noise random color, advanced options }
-procedure Noise(Bitmap: TBGRABitmap; touchR, touchG, touchB, touchA: boolean);
+procedure Noise(Bitmap: TBGRABitmap; touchR, touchG, touchB, touchA: boolean); overload;
 { Noise random color, random alpha }
 procedure NoiseA(Bitmap: TBGRABitmap);
 
 { Noise random color, set max posible values }
-procedure NoiseMax(Bitmap: TBGRABitmap; maxR, maxG, maxB, maxA: byte);
+procedure NoiseMax(Bitmap: TBGRABitmap; maxR, maxG, maxB, maxA: byte); overload;
 { Noise random color, set max posible values, advanced options }
 procedure NoiseMax(Bitmap: TBGRABitmap; maxR, maxG, maxB, maxA: byte;
-  touchR, touchG, touchB, touchA: boolean);
+  touchR, touchG, touchB, touchA: boolean); overload;
 
 { Noise black and white, keep alpha }
 procedure NoiseBW(Bitmap: TBGRABitmap);
@@ -183,9 +188,9 @@ procedure CheckeredL(Bitmap: TBGRABitmap);
 procedure CheckeredR(Bitmap: TBGRABitmap);
 
 { Black and White, middle 128 }
-procedure BlackAndWhite(Bitmap: TBGRABitmap);
+procedure BlackAndWhite(Bitmap: TBGRABitmap); overload;
 { Black and White, custom middle }
-procedure BlackAndWhite(Bitmap: TBGRABitmap; middle: byte);
+procedure BlackAndWhite(Bitmap: TBGRABitmap; middle: byte); overload;
 
 { Instagram Filters }
 // sepia
@@ -223,9 +228,9 @@ var
 begin
   sf := bcsNone;
   Result := sf;
-  ls := UTF8LowerCase(s);
+  ls := {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(s);
   for sf := low(TBCSimpleFilter) to high(TBCSimpleFilter) do
-    if ls = UTF8LowerCase(BCSimpleFilterStr[sf]) then
+    if ls = {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(BCSimpleFilterStr[sf]) then
     begin
       Result := sf;
       break;

+ 14 - 4
bcgamegrid.pas

@@ -33,15 +33,21 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCGameGrid;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, LCLProc, Types;
+  Classes, SysUtils, {$IFDEF FPC}LResources, LCLProc,{$ENDIF} Types, Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes;
 
 type
 
@@ -108,15 +114,19 @@ type
     property OnMouseWheelUp;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
+  {$IFDEF FPC}
   {$I icons\bcgamegrid_icon.lrs}
+  {$ENDIF}
   RegisterComponents('BGRA Controls', [TBCGameGrid]);
 end;
+{$ENDIF}
 
 { TBCCustomGrid }
 

+ 74 - 106
bcimagebutton.pas

@@ -33,19 +33,26 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCImageButton;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, Forms, Controls, Graphics, LResources, LMessages, ExtCtrls,
+  Classes, SysUtils, Forms, Controls, Graphics,
+  {$IFDEF FPC}LCLType, LResources, LMessages,{$ENDIF} ExtCtrls,
   Types,
+  {$IFNDEF FPC}Windows, Messages, BGRAGraphics, GraphType, FPImage, {$ENDIF}
   { BGRAControls }
   BCBaseCtrls, BCEffect,
   { BGRABitmap }
-  BGRABitmap, BGRABitmapTypes, BGRASliceScaling, Dialogs;
+  BGRABitmap, BGRABitmapTypes, BGRASliceScaling;
 
 {off $DEFINE DEBUG}
 
@@ -75,7 +82,6 @@ type
     procedure DoMouseUp; virtual;
     procedure DoMouseEnter; virtual;
     procedure DoMouseLeave; virtual;
-    procedure DoMouseMove(x, y: integer); virtual;
   protected
     procedure Click; override;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
@@ -83,7 +89,6 @@ type
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseEnter; override;
     procedure MouseLeave; override;
-    procedure MouseMove(Shift: TShiftState; X,Y: Integer); override;
   public
     property ModalResult: TModalResult
       read FModalResult write FModalResult default mrNone;
@@ -121,7 +126,9 @@ type
     property Font;
     property ParentBidiMode;
     property ModalResult;
+    {$IFDEF FPC}
     property OnChangeBounds;
+    {$ENDIF}
     property OnClick;
     property OnContextPopup;
     property OnDragDrop;
@@ -230,10 +237,8 @@ type
 
   TBCCustomImageButton = class(TBCGraphicButton)
   private
-    FAlphaTest: boolean;
-    FAlphaTestValue: byte;
     { Private declarations }
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     FDrawCount: integer;
     FRenderCount: integer;
     {$ENDIF}
@@ -248,9 +253,6 @@ type
     FBitmapFile: string;
     FTextVisible: boolean;
     FToggle: boolean;
-    FMouse: TPoint;
-    procedure SetFAlphaTest(AValue: boolean);
-    procedure SetFAlphaTestValue(AValue: byte);
     procedure SetFAnimation(AValue: boolean);
     procedure SetFBitmapFile(AValue: string);
     procedure SetFBitmapOptions(AValue: TBCImageButtonSliceScalingOptions);
@@ -264,21 +266,19 @@ type
     procedure RenderControl; override;
     procedure TextChanged; override;
     procedure FontChanged(Sender: TObject); override;
-    procedure CMChanged(var {%H-}Message: TLMessage); message CM_CHANGED; virtual;
-    {$IFDEF DEBUG}
+    procedure CMChanged(var {%H-}Message: {$IFDEF FPC}TLMessage{$ELSE}TMessage{$ENDIF}); message CM_CHANGED; {$IFDEF FPC}virtual;{$ENDIF}
+    {$IFDEF INDEBUG}
+    {$IFDEF FPC}
     function GetDebugText: string;
     {$ENDIF}
+    {$ENDIF}
     procedure DoMouseDown; override;
     procedure DoMouseUp; override;
     procedure DoMouseEnter; override;
     procedure DoMouseLeave; override;
-    procedure DoMouseMove(x, y: integer); override;
     procedure Click; override;
   public
     { Public declarations }
-    property AlphaTest: boolean read FAlphaTest write SetFAlphaTest default True;
-    property AlphaTestValue: byte
-      read FAlphaTestValue write SetFAlphaTestValue default 255;
     property Toggle: boolean read FToggle write SetFToggle default False;
     property Pressed: boolean read FPressed write SetFPressed default False;
     //property State: TBCGraphicButtonState read FState;
@@ -290,14 +290,16 @@ type
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     { It loads the 'BitmapFile' }
-    procedure LoadFromBitmapResource(const Resource: string; ResourceType: PChar); overload;
-    procedure LoadFromBitmapResource(const Resource: string); overload;
+    procedure LoadFromBitmapResource(Resource: string; ResourceType: PChar); overload;
+    procedure LoadFromBitmapResource(Resource: string); overload;
     procedure LoadFromBitmapFile;
     procedure Assign(Source: TPersistent); override;
     { Streaming }
-    procedure SaveToFile(AFileName: string);
-    procedure LoadFromFile(AFileName: string);
-    procedure AssignFromFile(AFileName: string);
+    {$IFDEF FPC}
+    procedure SaveToFile(AFileName: string); override;
+    procedure LoadFromFile(AFileName: string); override;
+    procedure AssignFromFile(AFileName: string); override;
+    {$ENDIF}
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
   published
@@ -306,8 +308,6 @@ type
 
   TBCImageButton = class(TBCCustomImageButton)
   published
-    property AlphaTest;
-    property AlphaTestValue;
     property Action;
     property Align;
     property Anchors;
@@ -330,7 +330,9 @@ type
     property Enabled;
     property Font;
     property ModalResult;
+    {$IFDEF FPC}
     property OnChangeBounds;
+    {$ENDIF}
     property OnClick;
     property OnContextPopup;
     property OnDragDrop;
@@ -363,20 +365,20 @@ type
     property Visible;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses
-  LCLType;
-
-procedure Register;
+{$IFDEF FPC}procedure Register;
 begin
+  {$IFDEF FPC}
   {$I icons\bcimagebutton_icon.lrs}
-  RegisterComponents('BGRA Button Controls', [TBCImageButton]);
+  {$ENDIF}
+  RegisterComponents('BGRA Controls', [TBCImageButton]);
   //{$I icons\bcxbutton_icon.lrs}
-  RegisterComponents('BGRA Button Controls', [TBCXButton]);
+  RegisterComponents('BGRA Controls', [TBCXButton]);
 end;
+{$ENDIF}
 
 function CalculateAspectRatioH(W1, H1, W2: integer): integer;
 begin
@@ -866,11 +868,6 @@ begin
   end;
 end;
 
-procedure TBCGraphicButton.DoMouseMove(x, y: integer);
-begin
-  inherited;
-end;
-
 procedure TBCGraphicButton.Click;
 begin
   DoClick;
@@ -904,12 +901,6 @@ begin
   DoMouseLeave;
 end;
 
-procedure TBCGraphicButton.MouseMove(Shift: TShiftState; X, Y: Integer);
-begin
-  inherited MouseMove(Shift, X, Y);
-  DoMouseMove(X, Y);
-end;
-
 { TBCCustomImageButton }
 
 procedure TBCCustomImageButton.Fade(Sender: TObject);
@@ -956,24 +947,6 @@ begin
   if FAnimation = AValue then
     Exit;
   FAnimation := AValue;
-
-  if csDesigning in ComponentState then
-    Exit;
-  FTimer.Enabled := FAnimation;
-end;
-
-procedure TBCCustomImageButton.SetFAlphaTest(AValue: boolean);
-begin
-  if FAlphaTest = AValue then
-    Exit;
-  FAlphaTest := AValue;
-end;
-
-procedure TBCCustomImageButton.SetFAlphaTestValue(AValue: byte);
-begin
-  if FAlphaTestValue = AValue then
-    Exit;
-  FAlphaTestValue := AValue;
 end;
 
 procedure TBCCustomImageButton.SetFBitmapFile(AValue: string);
@@ -987,10 +960,14 @@ procedure TBCCustomImageButton.DrawControl;
 var
   temp: TBGRABitmap;
 begin
+  {$IFNDEF FPC}//# //@  IN DELPHI RenderControl NEDD. IF NO RenderControl BE BLACK AFTER INVALIDATE.
+  RenderControl;
+  {$ENDIF}
+
   if Color <> clDefault then
   begin
     Canvas.Brush.Color := Color;
-    Canvas.FillRect(0, 0, Width, Height);
+    Canvas.FillRect(Rect(0, 0, Width, Height));
   end;
 
   if Enabled then
@@ -1027,11 +1004,11 @@ begin
   else
     FBGRADisabled.Draw(Canvas, FDestRect.Left, FDestRect.Top, False);
 
-  {$IFDEF DEBUG}
-  FDrawCount += 1;
+  {$IFDEF INDEBUG}
+  FDrawCount := FDrawCount +1;
   {$ENDIF}
 
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   Canvas.Brush.Color := clWhite;
   Canvas.TextOut(0, 0, GetDebugText);
   {$ENDIF}
@@ -1046,7 +1023,7 @@ procedure TBCCustomImageButton.RenderControl;
       Font.Color);
   end;
 
-{$IFDEF DEBUG}
+{$IFDEF INDEBUG}
 const
   Debug = True;
 {$ELSE}
@@ -1140,14 +1117,13 @@ begin
     FDestRect := Rect(0, 0, Width, Height);
 
     { Draw default style in cache bitmaps }
-    FBGRANormal.Rectangle(0, 0, Width, Height, BGRA(173, 173, 173), BGRA(225, 225, 225),
+    FBGRANormal.Rectangle(0, 0, Width, Height, BGRABlack, BGRA(0, 0, 255),
       dmSet);
-    FBGRAHover.Rectangle(0, 0, Width, Height, BGRA(0, 120, 215), BGRA(229, 241, 251),
+    FBGRAHover.Rectangle(0, 0, Width, Height, BGRABlack, BGRA(0, 255, 0),
       dmSet);
-    FBGRAActive.Rectangle(0, 0, Width, Height, BGRA(0, 84, 153), BGRA(204, 228, 247),
+    FBGRAActive.Rectangle(0, 0, Width, Height, BGRABlack, BGRA(255, 0, 0),
       dmSet);
-    FBGRADisabled.Rectangle(0, 0, Width, Height, BGRA(191, 191, 191),
-      BGRA(204, 204, 204),
+    FBGRADisabled.Rectangle(0, 0, Width, Height, BGRABlack, BGRA(100, 100, 100),
       dmSet);
 
     { Draw Text }
@@ -1157,16 +1133,18 @@ begin
     DrawText(FBGRADisabled);
   end;
 
-  {$IFDEF DEBUG}
-  FRenderCount += 1;
+  {$IFDEF INDEBUG}
+  FRenderCount := FRenderCount +1;
   {$ENDIF}
 end;
 
 procedure TBCCustomImageButton.TextChanged;
 begin
   InvalidatePreferredSize;
+  {$IFDEF FPC}//#
   if Assigned(Parent) and Parent.AutoSize then
     Parent.AdjustSize;
+  {$ENDIF}
   AdjustSize;
   RenderControl;
   Invalidate;
@@ -1179,25 +1157,24 @@ begin
   Invalidate;
 end;
 
-procedure TBCCustomImageButton.CMChanged(var Message: TLMessage);
+procedure TBCCustomImageButton.CMChanged(var Message: {$IFDEF FPC}TLMessage{$ELSE}TMessage{$ENDIF});
 begin
   if csReadingState in ControlState then
     Exit;
   RenderControl;
 end;
 
-{$IFDEF DEBUG}
+{$IFDEF INDEBUG}
+{$IFDEF FPC}
 function TBCCustomImageButton.GetDebugText: string;
 begin
   Result := 'Render: ' + IntToStr(FRenderCount) + ' Draw: ' + IntToStr(FDrawCount);
 end;
-
+{$ENDIF}
 {$ENDIF}
 
 procedure TBCCustomImageButton.DoMouseDown;
 begin
-  if FAlphaTest and (FBGRANormal.GetPixel(FMouse.X, FMouse.Y).alpha < FAlphaTestValue) then
-    Exit;
   FFade.Mode := fmFadeOut;
 
   if Animation then
@@ -1212,16 +1189,15 @@ procedure TBCCustomImageButton.DoMouseUp;
 var
   Ctrl: TControl;
 begin
-  if FAlphaTest and (FBGRANormal.GetPixel(FMouse.X, FMouse.Y).alpha < FAlphaTestValue) then
-    Exit;
   FFade.Mode := fmFadeIn;
 
   if Animation then
     FFade.Step := 20
   else
     FFade.Step := 255;
-
+  {$IFDEF FPC} //#
   Ctrl := Application.GetControlAtMouse;
+  {$ENDIF}
   if Ctrl = Self then
     DoMouseEnter
   else
@@ -1254,20 +1230,8 @@ begin
   inherited DoMouseLeave;
 end;
 
-procedure TBCCustomImageButton.DoMouseMove(x, y: integer);
-begin
-  FMouse := Point(X, Y);
-  if FAlphaTest then
-    if FBGRANormal.GetPixel(X, Y).alpha >= FAlphaTestValue then
-      DoMouseEnter
-    else
-      DoMouseLeave;
-end;
-
 procedure TBCCustomImageButton.Click;
 begin
-  if FAlphaTest and (FBGRANormal.GetPixel(FMouse.X, FMouse.Y).alpha < FAlphaTestValue) then
-    Exit;
   inherited Click;
   if (Toggle) then
   begin
@@ -1278,48 +1242,51 @@ end;
 constructor TBCCustomImageButton.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FDrawCount := 0;
   FRenderCount := 0;
   {$ENDIF}
+  {$IFDEF FPC}
   DisableAutoSizing;
   Include(FControlState, csCreating);
+  {$ELSE} //#
+
+  {$ENDIF}
   BeginUpdate;
   try
+    FBitmapOptions := TBCImageButtonSliceScalingOptions.Create(Self);
+
     with GetControlClassDefaultSize do
       SetInitialBounds(0, 0, CX, CY);
     ControlStyle := ControlStyle + [csAcceptsControls];
 
-    FBitmapOptions := TBCImageButtonSliceScalingOptions.Create(Self);
+//    FBitmapOptions := TBCImageButtonSliceScalingOptions.Create(Self);
     {FBitmapOptions.Bitmap := TBGRABitmap.Create(1,4,BGRAWhite);
     FBitmapOptions.Bitmap.SetPixel(0,0,BGRA(255,0,0,255));
     FBitmapOptions.Bitmap.SetPixel(0,1,BGRA(0,255,0,255));
     FBitmapOptions.Bitmap.SetPixel(0,2,BGRA(0,0,255,255));
     FBitmapOptions.Bitmap.SetPixel(0,3,BGRA(100,100,100,255));}
 
-    FAlphaTest := True;
-    FAlphaTestValue := 255;
     FFade.Step := 15;
     FFade.Mode := fmFadeOut;
     FTimer := TTimer.Create(Self);
     FTimer.Interval := 15;
-    FTimer.OnTimer := @Fade;
-    if csDesigning in ComponentState then
-      FTimer.Enabled := False;
+    FTimer.OnTimer := Fade;
     FAnimation := True;
     FTextVisible := True;
 
   finally
+    {$IFDEF FPC}
     Exclude(FControlState, csCreating);
     EnableAutoSizing;
+    {$ELSE} //#
+    {$ENDIF}
     EndUpdate;
   end;
 end;
 
 destructor TBCCustomImageButton.Destroy;
 begin
-  FTimer.Enabled := False;
-  FTimer.OnTimer := nil;
   FTimer.Free;
   if FBGRAMultiSliceScaling <> nil then
     FreeAndNil(FBGRAMultiSliceScaling);
@@ -1335,7 +1302,7 @@ begin
   inherited Destroy;
 end;
 
-procedure TBCCustomImageButton.LoadFromBitmapResource(const Resource: string;
+procedure TBCCustomImageButton.LoadFromBitmapResource(Resource: string;
   ResourceType: PChar);
 var
   res: TResourceStream;
@@ -1349,7 +1316,7 @@ begin
   res.Free;
 end;
 
-procedure TBCCustomImageButton.LoadFromBitmapResource(const Resource: string);
+procedure TBCCustomImageButton.LoadFromBitmapResource(Resource: string);
 begin
   LoadFromBitmapResource(Resource, RT_RCDATA);
 end;
@@ -1389,7 +1356,7 @@ begin
   else
     inherited Assign(Source);
 end;
-
+{$IFDEF FPC}
 procedure TBCCustomImageButton.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -1410,7 +1377,7 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
@@ -1425,13 +1392,14 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(AButton), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(AButton), OnFindClass);
     Assign(AButton);
   finally
     AStream.Free;
     AButton.Free;
   end;
 end;
+{$ENDIF}
 
 procedure TBCCustomImageButton.OnFindClass(Reader: TReader;
   const AClassName: string; var ComponentClass: TComponentClass);

+ 56 - 38
bckeyboard.pas

@@ -1,13 +1,18 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCKeyboard;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BCThemeManager, BCButton, BCPanel, MouseAndKeyInput,
-  LCLType;
+  Classes, SysUtils, {$IFDEF FPC}LCLType, LResources, LMessages,{$ENDIF}Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}Types, Windows, Messages, BGRAGraphics, GraphType, FPImage, BCBaseCtrls,{$ENDIF}
+  BCThemeManager, BCButton, BCPanel, MouseAndKeyInput;
 
 type
 
@@ -39,9 +44,9 @@ type
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     // Show in a custom form or panel
-    procedure Show(AControl: TWinControl);
+    procedure Show(AControl: TWinControl); overload;
     // Try to Show in the form where this component is placed
-    procedure Show();
+    procedure Show(); overload;
     // Hide the component
     procedure Hide();
     // Update buttons style
@@ -59,14 +64,15 @@ type
     property ThemeManager: TBCThemeManager read FBCThemeManager write SetFThemeManager;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-procedure Register;
+{$IFDEF FPC}procedure Register;
 begin
   RegisterComponents('BGRA Controls', [TBCKeyboard]);
 end;
+{$ENDIF}
 
 { TBCKeyboard }
 
@@ -169,7 +175,11 @@ begin
     KeyInput.Press(VK_BACK);
     Application.ProcessMessages;
     {$ELSE}
-    Application.QueueAsyncCall(@PressVirtKey, VK_BACK);
+      {$IFDEF FPC}
+      Application.QueueAsyncCall(@PressVirtKey, VK_BACK);
+      {$ELSE}
+      SendKey(VK_BACK);
+      {$ENDIF}
     {$ENDIF}
   end
   else
@@ -186,9 +196,17 @@ begin
     Application.ProcessMessages;
     {$ELSE}
     if F_shift.Down then
+      {$IFDEF FPC}
       Application.QueueAsyncCall(@PressShiftVirtKey, Ord(UpperCase(str)[1]))
+      {$ELSE}
+      SendKey(Ord(UpperCase(str)[1]), Shift)
+      {$ENDIF}
     else
+      {$IFDEF FPC}
       Application.QueueAsyncCall(@PressVirtKey, Ord(UpperCase(str)[1]));
+      {$ELSE}
+      SendKey(Ord(UpperCase(str)[1]))
+      {$ENDIF}
     {$ENDIF}
   end;
 
@@ -224,52 +242,52 @@ begin
   F_q := TBCButton.Create(FRow1);
   F_q.Caption := 'Q';
   F_q.Parent := FRow1;
-  F_q.OnMouseDown := @OnButtonClick;
+  F_q.OnMouseDown := OnButtonClick;
 
   F_w := TBCButton.Create(FRow1);
   F_w.Caption := 'W';
   F_w.Parent := FRow1;
-  F_w.OnMouseDown := @OnButtonClick;
+  F_w.OnMouseDown := OnButtonClick;
 
   F_e := TBCButton.Create(FRow1);
   F_e.Caption := 'E';
   F_e.Parent := FRow1;
-  F_e.OnMouseDown := @OnButtonClick;
+  F_e.OnMouseDown := OnButtonClick;
 
   F_r := TBCButton.Create(FRow1);
   F_r.Caption := 'R';
   F_r.Parent := FRow1;
-  F_r.OnMouseDown := @OnButtonClick;
+  F_r.OnMouseDown := OnButtonClick;
 
   F_t := TBCButton.Create(FRow1);
   F_t.Caption := 'T';
   F_t.Parent := FRow1;
-  F_t.OnMouseDown := @OnButtonClick;
+  F_t.OnMouseDown := OnButtonClick;
 
   F_y := TBCButton.Create(FRow1);
   F_y.Caption := 'Y';
   F_y.Parent := FRow1;
-  F_y.OnMouseDown := @OnButtonClick;
+  F_y.OnMouseDown := OnButtonClick;
 
   F_u := TBCButton.Create(FRow1);
   F_u.Caption := 'U';
   F_u.Parent := FRow1;
-  F_u.OnMouseDown := @OnButtonClick;
+  F_u.OnMouseDown := OnButtonClick;
 
   F_i := TBCButton.Create(FRow1);
   F_i.Caption := 'I';
   F_i.Parent := FRow1;
-  F_i.OnMouseDown := @OnButtonClick;
+  F_i.OnMouseDown := OnButtonClick;
 
   F_o := TBCButton.Create(FRow1);
   F_o.Caption := 'O';
   F_o.Parent := FRow1;
-  F_o.OnMouseDown := @OnButtonClick;
+  F_o.OnMouseDown := OnButtonClick;
 
   F_p := TBCButton.Create(FRow1);
   F_p.Caption := 'P';
   F_p.Parent := FRow1;
-  F_p.OnMouseDown := @OnButtonClick;
+  F_p.OnMouseDown := OnButtonClick;
 
 
   { asdfghjkl }
@@ -285,47 +303,47 @@ begin
   F_a := TBCButton.Create(FRow2);
   F_a.Caption := 'A';
   F_a.Parent := FRow2;
-  F_a.OnMouseDown := @OnButtonClick;
+  F_a.OnMouseDown := OnButtonClick;
 
   F_s := TBCButton.Create(FRow2);
   F_s.Caption := 'S';
   F_s.Parent := FRow2;
-  F_s.OnMouseDown := @OnButtonClick;
+  F_s.OnMouseDown := OnButtonClick;
 
   F_d := TBCButton.Create(FRow2);
   F_d.Caption := 'D';
   F_d.Parent := FRow2;
-  F_d.OnMouseDown := @OnButtonClick;
+  F_d.OnMouseDown := OnButtonClick;
 
   F_f := TBCButton.Create(FRow2);
   F_f.Caption := 'F';
   F_f.Parent := FRow2;
-  F_f.OnMouseDown := @OnButtonClick;
+  F_f.OnMouseDown := OnButtonClick;
 
   F_g := TBCButton.Create(FRow2);
   F_g.Caption := 'G';
   F_g.Parent := FRow2;
-  F_g.OnMouseDown := @OnButtonClick;
+  F_g.OnMouseDown := OnButtonClick;
 
   F_h := TBCButton.Create(FRow2);
   F_h.Caption := 'H';
   F_h.Parent := FRow2;
-  F_h.OnMouseDown := @OnButtonClick;
+  F_h.OnMouseDown := OnButtonClick;
 
   F_j := TBCButton.Create(FRow2);
   F_j.Caption := 'J';
   F_j.Parent := FRow2;
-  F_j.OnMouseDown := @OnButtonClick;
+  F_j.OnMouseDown := OnButtonClick;
 
   F_k := TBCButton.Create(FRow2);
   F_k.Caption := 'K';
   F_k.Parent := FRow2;
-  F_k.OnMouseDown := @OnButtonClick;
+  F_k.OnMouseDown := OnButtonClick;
 
   F_l := TBCButton.Create(FRow2);
   F_l.Caption := 'L';
   F_l.Parent := FRow2;
-  F_l.OnMouseDown := @OnButtonClick;
+  F_l.OnMouseDown := OnButtonClick;
 
   { zxcvbnm }
 
@@ -340,48 +358,48 @@ begin
   F_shift := TBCButton.Create(FRow3);
   F_shift.Caption := '^';
   F_shift.Parent := FRow3;
-  F_shift.OnMouseDown := @OnButtonClick;
+  F_shift.OnMouseDown := OnButtonClick;
   F_shift.Down := True;
 
   F_z := TBCButton.Create(FRow3);
   F_z.Caption := 'Z';
   F_z.Parent := FRow3;
-  F_z.OnMouseDown := @OnButtonClick;
+  F_z.OnMouseDown := OnButtonClick;
 
   F_x := TBCButton.Create(FRow3);
   F_x.Caption := 'X';
   F_x.Parent := FRow3;
-  F_x.OnMouseDown := @OnButtonClick;
+  F_x.OnMouseDown := OnButtonClick;
 
   F_c := TBCButton.Create(FRow3);
   F_c.Caption := 'C';
   F_c.Parent := FRow3;
-  F_c.OnMouseDown := @OnButtonClick;
+  F_c.OnMouseDown := OnButtonClick;
 
   F_v := TBCButton.Create(FRow3);
   F_v.Caption := 'V';
   F_v.Parent := FRow3;
-  F_v.OnMouseDown := @OnButtonClick;
+  F_v.OnMouseDown := OnButtonClick;
 
   F_b := TBCButton.Create(FRow3);
   F_b.Caption := 'B';
   F_b.Parent := FRow3;
-  F_b.OnMouseDown := @OnButtonClick;
+  F_b.OnMouseDown := OnButtonClick;
 
   F_n := TBCButton.Create(FRow3);
   F_n.Caption := 'N';
   F_n.Parent := FRow3;
-  F_n.OnMouseDown := @OnButtonClick;
+  F_n.OnMouseDown := OnButtonClick;
 
   F_m := TBCButton.Create(FRow3);
   F_m.Caption := 'M';
   F_m.Parent := FRow3;
-  F_m.OnMouseDown := @OnButtonClick;
+  F_m.OnMouseDown := OnButtonClick;
 
   F_back := TBCButton.Create(FRow3);
   F_back.Caption := '<-';
   F_back.Parent := FRow3;
-  F_back.OnMouseDown := @OnButtonClick;
+  F_back.OnMouseDown := OnButtonClick;
 
   { shift space back }
 
@@ -396,7 +414,7 @@ begin
   F_space := TBCButton.Create(FRow4);
   F_space.Caption := '____________________';
   F_space.Parent := FRow4;
-  F_space.OnMouseDown := @OnButtonClick;
+  F_space.OnMouseDown := OnButtonClick;
 end;
 
 destructor TBCKeyboard.Destroy;

+ 49 - 24
bclabel.pas

@@ -34,15 +34,21 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCLabel;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BCBasectrls, BGRABitmap, BGRABitmapTypes, BCTypes, types;
+  Classes, SysUtils,{$IFDEF FPC}LResources,{$ENDIF}
+  types, Forms, Controls, Graphics, Dialogs,
+  BCBasectrls, BGRABitmap, BGRABitmapTypes, BCTypes;
 
 type
 
@@ -51,7 +57,7 @@ type
   TCustomBCLabel = class(TBCStyleGraphicControl)
   private
     { Private declarations }
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     FRenderCount: Integer;
     {$ENDIF}
     FBackground: TBCBackground;
@@ -67,15 +73,15 @@ type
     procedure SetBackground(AValue: TBCBackground);
     procedure SetBorder(AValue: TBCBorder);
     procedure SetFontEx(AValue: TBCFont);
-    procedure OnChangeProperty(Sender: TObject; {%H-}Data: PtrInt);
-    procedure OnChangeFont({%H-}Sender: TObject; {%H-}AData: PtrInt);
+    procedure OnChangeProperty(Sender: TObject; {%H-}Data: BGRAPtrInt);
+    procedure OnChangeFont({%H-}Sender: TObject; {%H-}AData: BGRAPtrInt);
   protected
     procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
       {%H-}WithThemeSpace: boolean); override;
     class function GetControlClassDefaultSize: TSize; override;
     procedure TextChanged; override;
   protected
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     function GetDebugText: String; override;
     {$ENDIF}
     procedure DrawControl; override;
@@ -96,8 +102,10 @@ type
     procedure UpdateControl; override; // Called by EndUpdate
   public
     { Streaming }
-    procedure SaveToFile(AFileName: string);
-    procedure LoadFromFile(AFileName: string);
+    {$IFDEF FPC}
+    procedure SaveToFile(AFileName: string); override;
+    procedure LoadFromFile(AFileName: string); override;
+    {$ENDIF}
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
   end;
@@ -144,24 +152,25 @@ type
     property OnMouseWheelUp;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
 uses BCTools;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;
 begin
   //{$I icons\bclabel_icon.lrs}
   RegisterComponents('BGRA Controls',[TBCLabel]);
 end;
+{$ENDIF}
 
 { TCustomBCLabel }
 
 procedure TCustomBCLabel.Render;
 var r: TRect;
 begin
-  if (csCreating in FControlState) or IsUpdating then
+  if (csCreating in ControlState) or IsUpdating then
     Exit;
 
   FBGRA.NeedRender := False;
@@ -174,8 +183,11 @@ begin
   RenderBackgroundAndBorder(FBGRA.ClipRect, FBackground, TBGRABitmap(FBGRA), FRounding, FBorder, FInnerMargin);
   RenderText(FBGRA.ClipRect, FFontEx, Caption, TBGRABitmap(FBGRA));
 
-  {$IFDEF DEBUG}
-  FRenderCount += 1;
+  {$IFDEF INDEBUG}
+  FRenderCount := FRenderCount +1;
+  {$ENDIF}
+  {$IFNDEF FPC}//# //@  IN DELPHI NEEDRENDER NEED TO BE TRUE. IF FALSE COMPONENT IN BGRANORMAL BE BLACK AFTER INVALIDATE.
+  FBGRA.NeedRender := True;
   {$ENDIF}
 end;
 
@@ -226,7 +238,7 @@ begin
   Invalidate;
 end;
 
-procedure TCustomBCLabel.OnChangeProperty(Sender: TObject; Data: PtrInt);
+procedure TCustomBCLabel.OnChangeProperty(Sender: TObject; Data: BGRAPtrInt);
 begin
   RenderControl;
   if (Sender = FBorder) and AutoSize then
@@ -234,7 +246,7 @@ begin
   Invalidate;
 end;
 
-procedure TCustomBCLabel.OnChangeFont(Sender: TObject; AData: PtrInt);
+procedure TCustomBCLabel.OnChangeFont(Sender: TObject; AData: BGRAPtrInt);
 begin
   RenderControl;
   UpdateSize;
@@ -270,7 +282,7 @@ begin
   Invalidate;
 end;
 
-{$IFDEF DEBUG}
+{$IFDEF INDEBUG}
 function TCustomBCLabel.GetDebugText: String;
 begin
   Result := 'R: '+IntToStr(FRenderCount);
@@ -283,6 +295,9 @@ begin
   if FBGRA.NeedRender then
     Render;
   FBGRA.Draw(Self.Canvas,0,0,False);
+  {$IFNDEF FPC}//# //@  IN DELPHI RenderControl NEDD. IF NO RenderControl BE BLACK AFTER INVALIDATE.
+  FBGRA.NeedRender := True;
+  {$ENDIF}
 end;
 
 procedure TCustomBCLabel.RenderControl;
@@ -302,7 +317,7 @@ begin
   RenderControl;
   inherited UpdateControl; // invalidate
 end;
-
+{$IFDEF FPC}
 procedure TCustomBCLabel.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -323,11 +338,12 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
 end;
+ {$ENDIF}
 
 procedure TCustomBCLabel.OnFindClass(Reader: TReader; const AClassName: string;
   var ComponentClass: TComponentClass);
@@ -339,11 +355,15 @@ end;
 constructor TCustomBCLabel.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FRenderCount := 0;
   {$ENDIF}
+  {$IFDEF FPC}
   DisableAutoSizing;
   Include(FControlState, csCreating);
+  {$ELSE} //#
+
+  {$ENDIF}
   BeginUpdate;
   try
     with GetControlClassDefaultSize do
@@ -354,21 +374,26 @@ begin
     FFontEx             := TBCFont.Create(Self);
     ParentColor         := True;
 
-    FBackground.OnChange := @OnChangeProperty;
-    FBorder.OnChange     := @OnChangeProperty;
-    FFontEx.OnChange     := @OnChangeFont;
+    FBackground.OnChange := OnChangeProperty;
+    FBorder.OnChange     := OnChangeProperty;
+    FFontEx.OnChange     := OnChangeFont;
 
     FBackground.Style   := bbsClear;
     FBorder.Style       := bboNone;
 
     FRounding           := TBCRounding.Create(Self);
-    FRounding.OnChange  := @OnChangeProperty;
+    FRounding.OnChange  := OnChangeProperty;
 
     AutoSize := True;
   finally
+    {$IFDEF FPC}
     EnableAutoSizing;
+    {$ENDIF}
     EndUpdate;
+    {$IFDEF FPC}
     Exclude(FControlState, csCreating);
+    {$ELSE} //#
+    {$ENDIF}
   end;
 end;
 

+ 31 - 7
bclistbox.pas

@@ -1,12 +1,19 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCListBox;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  LCLType, BGRAVirtualScreen, BGRABitmap, BGRASliceScaling;
+  Classes, SysUtils, {$IFDEF FPC}LCLType, LResources, LMessages,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs, StdCtrls,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, BCBaseCtrls,{$ENDIF}
+  BGRAVirtualScreen, BGRABitmap, BGRASliceScaling;
 
 type
 
@@ -54,20 +61,27 @@ type
     property ListBox: TBCListBox read FListBox write FListBox;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
+
+{$IFDEF FPC}
 uses
   PropEdits;
+{$ENDIF}
 
+{$IFDEF FPC}
 procedure Register;
 begin
   RegisterComponents('BGRA Controls', [TBCListBox]);
   RegisterComponents('BGRA Controls', [TBCPaperPanel]);
   RegisterComponents('BGRA Controls', [TBCPaperListBox]);
+{$IFDEF FPC}//#
   RegisterPropertyEditor(TypeInfo(TBCListBox),
     TBCPaperListBox, 'ListBox', TClassPropertyEditor);
+{$ENDIF}
 end;
+{$ENDIF}
 
 { TBCPaperListBox }
 
@@ -86,13 +100,17 @@ end;
 { TBCPaperListBox }
 
 procedure TBCPaperPanel.LoadShadowFromBitmapResource;
+{$IFDEF FPC}
 var
   res: TLazarusResourceStream;
+{$ENDIF}
 begin
+{$IFDEF FPC}
   res := TLazarusResourceStream.Create('SHADOW', nil);
   FShadow := TBGRASliceScaling.Create(res);
   FShadow.Margins := Margins(6, 9, 6, 9);
   res.Free;
+{$ENDIF}
 end;
 
 procedure TBCPaperPanel.BCRedraw(Sender: TObject; ABitmap: TBGRABitmap);
@@ -104,7 +122,7 @@ constructor TBCPaperPanel.Create(TheOwner: TComponent);
 begin
   inherited Create(TheOwner);
   LoadShadowFromBitmapResource;
-  Self.OnRedraw := @BCRedraw;
+  Self.OnRedraw := BCRedraw;
 end;
 
 destructor TBCPaperPanel.Destroy;
@@ -121,6 +139,7 @@ var
   lb: TListBox;
   hg: integer;
 begin
+  {$IFDEF FPC}
   lb := TListBox(Control);
 
   lb.Canvas.Clipping := False;
@@ -141,19 +160,24 @@ begin
 
   lb.Canvas.Clipping := True;
   lb.Canvas.ClipRect := Rect(0, 0, 0, 0);
+  {$ENDIF}
 end;
 
 constructor TBCListBox.Create(TheOwner: TComponent);
 begin
   inherited Create(TheOwner);
   Self.Style := lbOwnerDrawFixed;
-  Self.OnDrawItem := @BCDrawItem;
+  Self.OnDrawItem := BCDrawItem;
+  {$IFDEF FPC}
   Self.ItemHeight := ScaleY(48, 96);
+  {$ENDIF}
   Self.BorderStyle := bsNone;
 end;
 
 initialization
 
-{$I bcpaperlistbox.lrs}
+  {$IFDEF FPC}
+  {$I bcpaperlistbox.lrs}
+  {$ENDIF}
 
 end.

+ 23 - 12
bcmaterialdesignbutton.pas

@@ -1,18 +1,23 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCMaterialDesignButton;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, Types, Controls, Graphics, ExtCtrls, BGRABitmap, BGRABitmapTypes,
-  LResources;
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF}
+  Types, Controls, Graphics, ExtCtrls, BCBaseCtrls, BGRABitmap, BGRABitmapTypes;
 
 type
 
   { TBCMaterialDesignButton }
 
-  TBCMaterialDesignButton = class(TGraphicControl)
+  TBCMaterialDesignButton = class(TBGRAGraphicCtrl)
   private
     FNormalColor: TColor;
     FNormalColorEffect: TColor;
@@ -67,7 +72,7 @@ type
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
   published
-    property RoundBorders: single read FRoundBorders write SetFRoundBorders default 5;
+    property RoundBorders: single read FRoundBorders write SetFRoundBorders {$IFDEF FPC}default 5{$ENDIF};
     property NormalColor: TColor read FNormalColor write SetFNormalColor default clWhite;
     property NormalColorEffect: TColor read FNormalColorEffect
       write SetFNormalColorEffect default clSilver;
@@ -96,13 +101,15 @@ type
     property AutoSize;
     property BidiMode;
     property BorderSpacing;
+    {$IFDEF FPC} //#
+    property OnChangeBounds;
+    {$ENDIF}
     property Caption;
     property Constraints;
     property DragCursor;
     property DragKind;
     property DragMode;
     property Enabled;
-    property OnChangeBounds;
     property OnClick;
     property OnContextPopup;
     property OnDragDrop;
@@ -126,7 +133,7 @@ type
     property Visible;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -173,11 +180,12 @@ begin
   Result := bmpOut;
 end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;
 begin
   //{$I icons\bcmaterialdesignbutton_icon.lrs}
-  RegisterComponents('BGRA Button Controls', [TBCMaterialDesignButton]);
+  RegisterComponents('BGRA Controls', [TBCMaterialDesignButton]);
 end;
+{$ENDIF}
 
 { TBCMaterialDesignButton }
 
@@ -325,7 +333,6 @@ var
 begin
   inherited CalculatePreferredSize(PreferredWidth, PreferredHeight,
     WithThemeSpace);
-
   if Caption <> '' then
   begin
     FBGRA.FontQuality := FTextQuality;
@@ -482,8 +489,10 @@ begin
   FTimer := TTimer.Create(Self);
   FTimer.Interval := 15;
   FTimer.Enabled := False;
-  FTimer.OnStartTimer := @OnStartTimer;
-  FTimer.OnTimer := @OnTimer;
+  {$IFDEF FPC}//#
+  FTimer.OnStartTimer := OnStartTimer;
+  {$ENDIF}
+  FTimer.OnTimer := OnTimer;
   FBGRA := TBGRABitmap.Create(Width, Height);
   FBGRAShadow := TBGRABitmap.Create(Width, Height);
   FRoundBorders := 5;
@@ -507,7 +516,9 @@ end;
 destructor TBCMaterialDesignButton.Destroy;
 begin
   FTimer.Enabled := False;
+  {$IFDEF FPC}//#
   FTimer.OnStartTimer := nil;
+  {$ENDIF}
   FTimer.OnTimer := nil;
   FreeAndNil(FBGRA);
   FreeAndNil(FBGRAShadow);

+ 61 - 21
bcmdbutton.pas

@@ -1,6 +1,11 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCMDButton;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 // Set this to show number of repaint in each MDBUTTON
 { $DEFINE MDBUTTON_DEBUG}
@@ -11,8 +16,9 @@ unit BCMDButton;
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BGRABitmap, BGRABitmapTypes, ExtCtrls, Math, Types, BGRABlend;
+  Classes, SysUtils, Types, {$IFDEF FPC}LResources,{$ELSE}BGRAGraphics, GraphType, FPImage,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs,
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, ExtCtrls, Math, BGRABlend;
 
 var
   // Default icons for Check Box
@@ -77,11 +83,11 @@ type
 
   { TCustomBCMDButton }
 
-  TCustomBCMDButton = class(TGraphicControl)
+  TCustomBCMDButton = class(TBGRAGraphicCtrl)
   private
     FChecked: boolean;
     FKind: TBCMDButtonKind;
-    {$IFDEF MDBUTTON_DEBUG}
+    {$IFDEF INDEBUG}
     FCount: integer;
     {$ENDIF}
     FRounding: integer;
@@ -168,6 +174,9 @@ type
     property AutoSize;
     property BidiMode;
     property BorderSpacing;
+    {$IFDEF FPC} //#
+    property OnChangeBounds;
+    {$ENDIF}
     //property Cancel;
     property Caption;
     property Color;
@@ -180,7 +189,6 @@ type
     property Font;
     property ParentBidiMode;
     //property ModalResult;
-    property OnChangeBounds;
     property OnClick;
     property OnContextPopup;
     property OnDragDrop;
@@ -211,7 +219,7 @@ type
     property Visible;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -221,10 +229,12 @@ var
 
 {$ENDIF}
 
+{$IFDEF FPC}
 procedure Register;
 begin
-  RegisterComponents('BGRA Button Controls', [TBCMDButton]);
+  RegisterComponents('BGRA Controls', [TBCMDButton]);
 end;
+{$ENDIF}
 
 { TBCMDButtonStyle }
 
@@ -369,13 +379,15 @@ begin
   s := bmp.TextSize(GetRealCaption);
   if FTextAutoSize then
   begin
-    PreferredWidth := s.Width + 26 + BorderSpacing.InnerBorder;
-    PreferredHeight := s.Height + 10 + BorderSpacing.InnerBorder;
+    PreferredWidth := s.Width + 26 {$IFDEF FPC}+ BorderSpacing.InnerBorder{$ENDIF};
+    PreferredHeight := s.Height + 10 {$IFDEF FPC}+ BorderSpacing.InnerBorder{$ENDIF};
   end
   else
   begin
+    {$IFDEF FPC}//#
     PreferredWidth := BorderSpacing.InnerBorder;
     PreferredHeight := BorderSpacing.InnerBorder;
+    {$ENDIF}
   end;
   bmp.Free;
 end;
@@ -424,19 +436,27 @@ begin
           bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
             FStyleNormal.Color,
             FStyleNormal.Color);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleNormal.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0,Width, Height),tempText, Alignment, TextLayout, FStyleNormal.TextColor);
+          {$ENDIF}
         end;
         mdbsHover:
         begin
           bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
             FStyleHover.Color, FStyleHover.Color);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleHover.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0,Width, Height),tempText, Alignment, TextLayout, FStyleHover.TextColor);
+          {$ENDIF}
         end;
         mdbsActive:
         begin
@@ -455,10 +475,14 @@ begin
             bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
               FStyleHover.Color,
               FStyleHover.Color);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleActive.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0,Width, Height),tempText, Alignment, TextLayout, FStyleActive.TextColor);
+          {$ENDIF}
         end;
       end;
     end
@@ -482,10 +506,14 @@ begin
           end;
           bmp.FillEllipseAntialias(FCX, FCY, iTemp,
             iTemp, tempColor);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleNormal.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0,Width, Height),tempText, Alignment, TextLayout, FStyleNormal.TextColor);
+          {$ENDIF}
         end;
         mdbsHover, mdbsActive:
         begin
@@ -501,10 +529,14 @@ begin
           end;
           bmp.FillEllipseAntialias(FCX, FCY, iTemp,
             iTemp, tempColor);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleHover.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0,Width, Height),tempText, Alignment, TextLayout, FStyleHover.TextColor);
+          {$ENDIF}
         end;
       end;
     end;
@@ -520,10 +552,14 @@ begin
     else
       bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
         FStyleDisabled.Color, FStyleDisabled.Color);
+    {$IFDEF FPC}
     bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
       Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
       tempText, Alignment,
       TextLayout, FStyleDisabled.TextColor);
+    {$ELSE}
+    bmp.TextRect(Rect(0, 0,Width, Height),tempText, Alignment, TextLayout, FStyleDisabled.TextColor);
+    {$ENDIF}
   end;
 
   // Tab
@@ -619,7 +655,7 @@ begin
   if MDAnimating = Self then
   begin
   {$ENDIF}
-    FPercent += BCMDBUTTONANIMATIONSPEED;
+    FPercent := FPercent + BCMDBUTTONANIMATIONSPEED;
     if FPercent < 0 then
       FPercent := 0
     else if FPercent > 1 then
@@ -627,7 +663,7 @@ begin
 
     if FPercent = 1 then
     begin
-      FAlphaPercent -= BCMDBUTTONANIMATIONSPEED;
+      FAlphaPercent := FAlphaPercent -BCMDBUTTONANIMATIONSPEED;
       if FAlphaPercent < 0 then
         FAlphaPercent := 0
       else if FAlphaPercent > 1 then
@@ -692,7 +728,7 @@ end;
 
 function TCustomBCMDButton.GetRealCaption: string;
 var
-  tempText: string = '';
+  tempText: string;
 begin
   tempText := Caption;
 
@@ -722,7 +758,7 @@ end;
 constructor TCustomBCMDButton.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FCount := 0;
   {$ENDIF}
   // State
@@ -738,13 +774,13 @@ begin
   // Style
   FRounding := 6;
   FStyleNormal := TBCMDButtonStyle.Create;
-  FStyleNormal.OnChange := @OnChangeStyle;
+  FStyleNormal.OnChange := OnChangeStyle;
   FStyleHover := TBCMDButtonStyle.Create;
-  FStyleHover.OnChange := @OnChangeStyle;
+  FStyleHover.OnChange := OnChangeStyle;
   FStyleActive := TBCMDButtonStyle.Create;
-  FStyleActive.OnChange := @OnChangeStyle;
+  FStyleActive.OnChange := OnChangeStyle;
   FStyleDisabled := TBCMDButtonStyle.Create;
-  FStyleDisabled.OnChange := @OnChangeStyle;
+  FStyleDisabled.OnChange := OnChangeStyle;
   // Default Style
   FStyleHover.Color := RGBToColor(220, 220, 220);
   FStyleActive.Color := RGBToColor(198, 198, 198);
@@ -754,9 +790,11 @@ begin
   FTimer := TTimer.Create(Self);
   FTimer.Enabled := False;
   FTimer.Interval := BCMDBUTTONTIMERSPEED;
-  FTimer.OnTimer := @OnTimer;
-  FTimer.OnStartTimer := @OnStartTimer;
-  FTimer.OnStopTimer := @OnStopTimer;
+  FTimer.OnTimer := OnTimer;
+  {$IFDEF FPC}//#
+  FTimer.OnStartTimer := OnStartTimer;
+  FTimer.OnStopTimer := OnStopTimer;
+  {$ENDIF}
   // Setup default sizes
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, CX, CY);
@@ -765,8 +803,10 @@ end;
 destructor TCustomBCMDButton.Destroy;
 begin
   FTimer.OnTimer := nil;
+  {$IFDEF FPC}//#
   FTimer.OnStartTimer := nil;
   FTimer.OnStopTimer := nil;
+  {$ENDIF}
   FTimer.Enabled := False;
   FStyleNormal.Free;
   FStyleHover.Free;

+ 69 - 27
bcmdbuttonfocus.pas

@@ -1,6 +1,11 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCMDButtonFocus;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 // Set this to show number of repaint in each MDBUTTON
 { $DEFINE MDBUTTON_DEBUG}
@@ -11,19 +16,20 @@ unit BCMDButtonFocus;
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BGRABitmap, BGRABitmapTypes, ExtCtrls, Math, Types, BGRABlend, BCMDButton,
-  LMessages, LCLType;
+  Classes, SysUtils, Types, {$IFDEF FPC}LCLType, LResources, LMessages,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}Windows, Messages, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, ExtCtrls, Math, BGRABlend, BCMDButton;
 
 type
 
   { TCustomBCMDButtonFocus }
 
-  TCustomBCMDButtonFocus = class(TCustomControl)
+  TCustomBCMDButtonFocus = class(TBGRACustomCtrl)
   private
     FChecked: boolean;
     FKind: TBCMDButtonKind;
-    {$IFDEF MDBUTTON_DEBUG}
+    {$IFDEF INDEBUG}
     FCount: integer;
     {$ENDIF}
     FRounding: integer;
@@ -58,8 +64,8 @@ type
     procedure SetFTextProportionalRatio(AValue: single);
   protected
     // START / MDBUTTONFOCUS ONLY
-    procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
-    procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
+    procedure WMSetFocus(var Message: {$IFDEF FPC}TLMSetFocus{$ELSE}TWMKillFocus{$ENDIF}); message {$IFDEF FPC}LM_SETFOCUS{$ELSE}WM_SETFOCUS{$ENDIF};
+    procedure WMKillFocus(var Message: {$IFDEF FPC}TLMKillFocus{$ELSE}TWMKillFocus{$ENDIF}); message {$IFDEF FPC}LM_KILLFOCUS{$ELSE}WM_KILLFOCUS{$ENDIF};
     procedure UpdateFocus(AFocused: boolean);
     procedure KeyDown(var Key: word; Shift: TShiftState); override;
     procedure KeyUp(var Key: word; Shift: TShiftState); override;
@@ -79,7 +85,7 @@ type
     function easeInOutQuad(t: double): double;
     function easeOutQuad(t: double): double;
     procedure UncheckOthers;
-    class function GetControlClassDefaultSize: TSize; override;
+    class function GetControlClassDefaultSize: TSize;override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -116,6 +122,9 @@ type
     property AutoSize;
     property BidiMode;
     property BorderSpacing;
+    {$IFDEF FPC} //#
+    property OnChangeBounds;
+    {$ENDIF}
     //property Cancel;
     property Caption;
     property Color;
@@ -128,7 +137,6 @@ type
     property Font;
     property ParentBidiMode;
     //property ModalResult;
-    property OnChangeBounds;
     property OnClick;
     property OnContextPopup;
     property OnDragDrop;
@@ -159,7 +167,7 @@ type
     property Visible;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -169,10 +177,12 @@ var
 
 {$ENDIF}
 
+{$IFDEF FPC}
 procedure Register;
 begin
-  RegisterComponents('BGRA Button Controls', [TBCMDButtonFocus]);
+  RegisterComponents('BGRA Controls', [TBCMDButtonFocus]);
 end;
+{$ENDIF}
 
 { TCustomBCMDButtonFocus }
 
@@ -274,14 +284,14 @@ begin
   Invalidate;
 end;
 
-procedure TCustomBCMDButtonFocus.WMSetFocus(var Message: TLMSetFocus);
+procedure TCustomBCMDButtonFocus.WMSetFocus(var Message:  {$IFDEF FPC}TLMSetFocus{$ELSE}TWMKillFocus{$ENDIF});
 begin
   inherited;
 
   UpdateFocus(True);
 end;
 
-procedure TCustomBCMDButtonFocus.WMKillFocus(var Message: TLMKillFocus);
+procedure TCustomBCMDButtonFocus.WMKillFocus(var Message: {$IFDEF FPC}TLMKillFocus{$ELSE}TWMKillFocus{$ENDIF});
 begin
   inherited;
 
@@ -297,11 +307,12 @@ begin
   if lForm = nil then
     exit;
 
+{$IFDEF FPC}//#
   if AFocused then
     ActiveDefaultControlChanged(lForm.ActiveControl)
   else
     ActiveDefaultControlChanged(nil);
-
+{$ENDIF}
   Invalidate;
 end;
 
@@ -342,13 +353,15 @@ begin
   s := bmp.TextSize(Caption);
   if FTextAutoSize then
   begin
-    PreferredWidth := s.Width + 26 + BorderSpacing.InnerBorder;
-    PreferredHeight := s.Height + 10 + BorderSpacing.InnerBorder;
+    PreferredWidth := s.Width + 26 {$IFDEF FPC}+ BorderSpacing.InnerBorder{$ENDIF};
+    PreferredHeight := s.Height + 10 {$IFDEF FPC}+ BorderSpacing.InnerBorder{$ENDIF};
   end
   else
   begin
+    {$IFDEF FPC}//#
     PreferredWidth := BorderSpacing.InnerBorder;
     PreferredHeight := BorderSpacing.InnerBorder;
+    {$ENDIF}
   end;
   bmp.Free;
 end;
@@ -423,19 +436,27 @@ begin
           bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
             FStyleNormal.Color,
             FStyleNormal.Color);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleNormal.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0, Width, Height), tempText, Alignment, TextLayout, FStyleNormal.TextColor);
+          {$ENDIF}
         end;
         mdbsHover:
         begin
           bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
             FStyleHover.Color, FStyleHover.Color);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleHover.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0, Width, Height), tempText, Alignment, TextLayout, FStyleHover.TextColor);
+          {$ENDIF}
         end;
         mdbsActive:
         begin
@@ -454,10 +475,14 @@ begin
             bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
               FStyleHover.Color,
               FStyleHover.Color);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleActive.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0, Width, Height), tempText, Alignment, TextLayout, FStyleActive.TextColor);
+          {$ENDIF}
         end;
       end;
     end
@@ -481,10 +506,14 @@ begin
           end;
           bmp.FillEllipseAntialias(FCX, FCY, iTemp,
             iTemp, tempColor);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleNormal.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0, Width, Height), tempText, Alignment, TextLayout, FStyleNormal.TextColor);
+          {$ENDIF}
         end;
         mdbsHover, mdbsActive:
         begin
@@ -500,10 +529,14 @@ begin
           end;
           bmp.FillEllipseAntialias(FCX, FCY, iTemp,
             iTemp, tempColor);
+          {$IFDEF FPC}
           bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
             Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
             tempText, Alignment,
             TextLayout, FStyleHover.TextColor);
+          {$ELSE}
+          bmp.TextRect(Rect(0, 0, Width, Height), tempText, Alignment, TextLayout, FStyleHover.TextColor);
+          {$ENDIF}
         end;
       end;
     end;
@@ -519,10 +552,14 @@ begin
     else
       bmp.RoundRect(0, 0, Width, Height, tempRounding, tempRounding,
         FStyleDisabled.Color, FStyleDisabled.Color);
+    {$IFDEF FPC}
     bmp.TextRect(Rect(BorderSpacing.InnerBorder, BorderSpacing.InnerBorder,
       Width - BorderSpacing.InnerBorder, Height - BorderSpacing.InnerBorder),
       tempText, Alignment,
       TextLayout, FStyleDisabled.TextColor);
+    {$ELSE}
+    bmp.TextRect(Rect(0, 0, Width, Height), tempText, Alignment, TextLayout, FStyleDisabled.TextColor);
+    {$ENDIF}
   end;
 
   // Tab
@@ -618,7 +655,7 @@ begin
   if MDAnimating = Self then
   begin
   {$ENDIF}
-    FPercent += BCMDBUTTONANIMATIONSPEED;
+    FPercent := FPercent + BCMDBUTTONANIMATIONSPEED;
     if FPercent < 0 then
       FPercent := 0
     else if FPercent > 1 then
@@ -626,7 +663,7 @@ begin
 
     if FPercent = 1 then
     begin
-      FAlphaPercent -= BCMDBUTTONANIMATIONSPEED;
+      FAlphaPercent := FAlphaPercent - BCMDBUTTONANIMATIONSPEED;
       if FAlphaPercent < 0 then
         FAlphaPercent := 0
       else if FAlphaPercent > 1 then
@@ -698,7 +735,7 @@ begin
   ControlStyle := ControlStyle + [csAcceptsControls];
   DoubleBuffered := True;
   // END / MDBUTTONFOCUS ONLY
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FCount := 0;
   {$ENDIF}
   // State
@@ -714,13 +751,13 @@ begin
   // Style
   FRounding := 6;
   FStyleNormal := TBCMDButtonStyle.Create;
-  FStyleNormal.OnChange := @OnChangeStyle;
+  FStyleNormal.OnChange := OnChangeStyle;
   FStyleHover := TBCMDButtonStyle.Create;
-  FStyleHover.OnChange := @OnChangeStyle;
+  FStyleHover.OnChange := OnChangeStyle;
   FStyleActive := TBCMDButtonStyle.Create;
-  FStyleActive.OnChange := @OnChangeStyle;
+  FStyleActive.OnChange := OnChangeStyle;
   FStyleDisabled := TBCMDButtonStyle.Create;
-  FStyleDisabled.OnChange := @OnChangeStyle;
+  FStyleDisabled.OnChange := OnChangeStyle;
   // Default Style
   FStyleHover.Color := RGBToColor(220, 220, 220);
   FStyleActive.Color := RGBToColor(198, 198, 198);
@@ -730,9 +767,12 @@ begin
   FTimer := TTimer.Create(Self);
   FTimer.Enabled := False;
   FTimer.Interval := BCMDBUTTONTIMERSPEED;
-  FTimer.OnTimer := @OnTimer;
-  FTimer.OnStartTimer := @OnStartTimer;
-  FTimer.OnStopTimer := @OnStopTimer;
+  FTimer.OnTimer := OnTimer;
+  {$IFDEF FPC}//#
+  FTimer.OnStartTimer := OnStartTimer;
+  FTimer.OnStopTimer := OnStopTimer;
+  {$ENDIF}
+
   // Setup default sizes
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, CX, CY);
@@ -741,8 +781,10 @@ end;
 destructor TCustomBCMDButtonFocus.Destroy;
 begin
   FTimer.OnTimer := nil;
+  {$IFDEF FPC}//#
   FTimer.OnStartTimer := nil;
   FTimer.OnStopTimer := nil;
+  {$ENDIF}
   FTimer.Enabled := False;
   FStyleNormal.Free;
   FStyleHover.Free;

+ 43 - 22
bcnumerickeyboard.pas

@@ -1,12 +1,19 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCNumericKeyboard;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BCPanel, BCButton, MouseAndKeyInput, LCLType, BCThemeManager;
+  Classes, SysUtils, {$IFDEF FPC}, LCLType, LResources, LMessages,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs, MouseAndKeyInput,
+  {$IFNDEF FPC}Types, Windows, BGRAGraphics, GraphType, FPImage, BCBaseCtrls, {$ENDIF}
+  BCPanel, BCButton, BCThemeManager;
 
 type
 
@@ -42,9 +49,9 @@ type
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     // Show in a custom form or panel
-    procedure Show(AControl: TWinControl);
+    procedure Show(AControl: TWinControl); overload;
     // Try to Show in the form where this component is placed
-    procedure Show();
+    procedure Show(); overload;
     // Hide the component
     procedure Hide();
     // Update buttons style
@@ -82,15 +89,17 @@ type
     property ThemeManager;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
   RegisterComponents('BGRA Controls', [TBCNumericKeyboard]);
   RegisterComponents('BGRA Controls', [TBCRealNumericKeyboard]);
 end;
+{$ENDIF}
 
 { TBCRealNumericKeyboard }
 
@@ -116,7 +125,11 @@ begin
     KeyInput.Press(VK_BACK);
     Application.ProcessMessages;
     {$ELSE}
-    Application.QueueAsyncCall(@PressVirtKey, VK_BACK);
+      {$IFDEF FPC}
+      Application.QueueAsyncCall(@PressVirtKey, VK_BACK);
+      {$ELSE}
+      SendKey(VK_BACK);
+      {$ENDIF}
     {$ENDIF}
   end
   else if num = FBtnDot.Caption then
@@ -126,7 +139,11 @@ begin
     KeyInput.Press(vk_DotNumPad);
     Application.ProcessMessages;
     {$ELSE}
-    Application.QueueAsyncCall(@PressVirtKey, vk_DotNumPad);
+      {$IFDEF FPC}
+      Application.QueueAsyncCall(@PressVirtKey, vk_DotNumPad);
+      {$ELSE}
+      SendKey(vk_DotNumPad);
+      {$ENDIF}
     {$ENDIF}
   end
   else
@@ -136,7 +153,11 @@ begin
     KeyInput.Press(Ord(TBCButton(Sender).Caption[1]));
     Application.ProcessMessages;
     {$ELSE}
-    Application.QueueAsyncCall(@PressVirtKey, Ord(TBCButton(Sender).Caption[1]));
+      {$IFDEF FPC}
+      Application.QueueAsyncCall(@PressVirtKey, Ord(TBCButton(Sender).Caption[1]));
+      {$ELSE}
+      SendKey(Ord(TBCButton(Sender).Caption[1]));
+      {$ENDIF}
     {$ENDIF}
   end;
 
@@ -235,62 +256,62 @@ begin
   FBtn7 := TBCButton.Create(FPanel);
   FBtn7.Parent := FPanel;
   FBtn7.Caption := '7';
-  FBtn7.OnMouseDown := @OnButtonClick;
+  FBtn7.OnMouseDown := OnButtonClick;
 
   FBtn8 := TBCButton.Create(FPanel);
   FBtn8.Parent := FPanel;
   FBtn8.Caption := '8';
-  FBtn8.OnMouseDown := @OnButtonClick;
+  FBtn8.OnMouseDown := OnButtonClick;
 
   FBtn9 := TBCButton.Create(FPanel);
   FBtn9.Caption := '9';
   FBtn9.Parent := FPanel;
-  FBtn9.OnMouseDown := @OnButtonClick;
+  FBtn9.OnMouseDown := OnButtonClick;
 
   FBtn4 := TBCButton.Create(FPanel);
   FBtn4.Parent := FPanel;
   FBtn4.Caption := '4';
-  FBtn4.OnMouseDown := @OnButtonClick;
+  FBtn4.OnMouseDown := OnButtonClick;
 
   FBtn5 := TBCButton.Create(FPanel);
   FBtn5.Parent := FPanel;
   FBtn5.Caption := '5';
-  FBtn5.OnMouseDown := @OnButtonClick;
+  FBtn5.OnMouseDown := OnButtonClick;
 
   FBtn6 := TBCButton.Create(FPanel);
   FBtn6.Parent := FPanel;
   FBtn6.Caption := '6';
-  FBtn6.OnMouseDown := @OnButtonClick;
+  FBtn6.OnMouseDown := OnButtonClick;
 
   FBtn1 := TBCButton.Create(FPanel);
   FBtn1.Parent := FPanel;
   FBtn1.Caption := '1';
-  FBtn1.OnMouseDown := @OnButtonClick;
+  FBtn1.OnMouseDown := OnButtonClick;
 
   FBtn2 := TBCButton.Create(FPanel);
   FBtn2.Parent := FPanel;
   FBtn2.Caption := '2';
-  FBtn2.OnMouseDown := @OnButtonClick;
+  FBtn2.OnMouseDown := OnButtonClick;
 
   FBtn3 := TBCButton.Create(FPanel);
   FBtn3.Parent := FPanel;
   FBtn3.Caption := '3';
-  FBtn3.OnMouseDown := @OnButtonClick;
+  FBtn3.OnMouseDown := OnButtonClick;
 
   FBtn0 := TBCButton.Create(FPanel);
   FBtn0.Parent := FPanel;
   FBtn0.Caption := '0';
-  FBtn0.OnMouseDown := @OnButtonClick;
+  FBtn0.OnMouseDown := OnButtonClick;
 
   FBtnDot := TBCButton.Create(FPanel);
   FBtnDot.Parent := FPanel;
-  FBtnDot.Caption := DefaultFormatSettings.DecimalSeparator;
-  FBtnDot.OnMouseDown := @OnButtonClick;
+  FBtnDot.Caption := {$IFDEF FPC}DefaultFormatSettings{$ELSE}FormatSettings{$ENDIF}.DecimalSeparator;
+  FBtnDot.OnMouseDown := OnButtonClick;
 
   FBtnClr := TBCButton.Create(FPanel);
   FBtnClr.Parent := FPanel;
   FBtnClr.Caption := 'C';
-  FBtnClr.OnMouseDown := @OnButtonClick;
+  FBtnClr.OnMouseDown := OnButtonClick;
 end;
 
 destructor TBCCustomNumericKeyboard.Destroy;

+ 53 - 25
bcpanel.pas

@@ -32,15 +32,20 @@
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCPanel;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BGRABitmap, BCBaseCtrls, BGRABitmapTypes, BCTypes, Types;
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF} Types, Forms, Controls, Graphics, Dialogs,
+  BGRABitmap, BCBaseCtrls, BGRABitmapTypes, BCTypes;
 
 type
   TOnAfterRenderBCPanel = procedure(Sender: TObject; const ABGRA: TBGRABitmap;
@@ -52,7 +57,7 @@ type
   TCustomBCPanel = class(TBCStyleCustomControl)
   private
     { Private declarations }
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     FRenderCount: Integer;
     {$ENDIF}
     FBackground: TBCBackground;
@@ -73,8 +78,8 @@ type
     procedure SetFontEx(AValue: TBCFont);
     procedure SetRounding(AValue: TBCRounding);
     procedure Render;
-    procedure OnChangeProperty({%H-}Sender: TObject; {%H-}AData: PtrInt);
-    procedure OnChangeFont({%H-}Sender: TObject; {%H-}AData: PtrInt);
+    procedure OnChangeProperty({%H-}Sender: TObject; {%H-}AData: BGRAPtrInt);
+    procedure OnChangeFont({%H-}Sender: TObject; {%H-}AData: BGRAPtrInt);
   protected
     { Protected declarations }
     procedure AdjustClientRect(var aRect: TRect); override;
@@ -84,7 +89,7 @@ type
     procedure TextChanged; override;
   protected
     function GetStyleExtension: String; override;
-    {$IFDEF DEBUG}
+    {$IFDEF INDEBUG}
     function GetDebugText: String; override;
     {$ENDIF}
     procedure DrawControl; override;
@@ -110,8 +115,10 @@ type
     procedure UpdateControl; override; // Called by EndUpdate
   public
     { Streaming }
+    {$IFDEF FPC}
     procedure SaveToFile(AFileName: string);
     procedure LoadFromFile(AFileName: string);
+    {$ENDIF}
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
   end;
@@ -125,6 +132,10 @@ type
     property AssignStyle;
     property AutoSize;
     property BorderSpacing;
+    property ChildSizing;
+    {$IFDEF FPC} //#
+    property OnGetDockCaption;
+    {$ENDIF}
     property Background;
     property BevelInner;
     property BevelOuter;
@@ -132,7 +143,6 @@ type
     property Border;
     property BorderBCStyle;
     property Caption;
-    property ChildSizing;
     property Constraints;
     property DockSite;
     property DragCursor;
@@ -159,7 +169,6 @@ type
     property OnEnter;
     property OnExit;
     property OnGetSiteInfo;
-    property OnGetDockCaption;
     property OnMouseDown;
     property OnMouseEnter;
     property OnMouseLeave;
@@ -175,17 +184,19 @@ type
     property OnAfterRenderBCPanel;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
 uses BCTools;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bcpanel_icon.lrs}
   RegisterComponents('BGRA Controls', [TBCPanel]);
 end;
+{$ENDIF}
 
 { TCustomBCPanel }
 
@@ -203,6 +214,10 @@ begin
   end
   else
     FBGRA.Draw(Self.Canvas, 0, 0);
+
+  {$IFNDEF FPC}//# //@  IN DELPHI RenderControl NEDD. IF NO RenderControl BE BLACK AFTER INVALIDATE.
+  FBGRA.NeedRender := True;
+  {$ENDIF}
 end;
 
 procedure TCustomBCPanel.RenderControl;
@@ -217,7 +232,7 @@ begin
   Result := 'bcpnl';
 end;
 
-{$IFDEF DEBUG}
+{$IFDEF INDEBUG}
 function TCustomBCPanel.GetDebugText: String;
 begin
   Result := 'R: '+IntToStr(FRenderCount);
@@ -227,7 +242,7 @@ end;
 procedure TCustomBCPanel.Render;
 var r: TRect;
 begin
-  if (csCreating in FControlState) or IsUpdating then
+  if (csCreating in ControlState) or IsUpdating then
     Exit;
 
   FBGRA.NeedRender := False;
@@ -268,18 +283,18 @@ begin
   if Assigned(FOnAfterRenderBCPanel) then
     FOnAfterRenderBCPanel(Self, FBGRA, r);
 
-  {$IFDEF DEBUG}
-  FRenderCount += 1;
+  {$IFDEF INDEBUG}
+  FRenderCount := FRenderCount + 1;
   {$ENDIF}
 end;
 
-procedure TCustomBCPanel.OnChangeProperty(Sender: TObject; AData: PtrInt);
+procedure TCustomBCPanel.OnChangeProperty(Sender: TObject; AData: BGRAPtrInt);
 begin
   RenderControl;
   Invalidate;
 end;
 
-procedure TCustomBCPanel.OnChangeFont(Sender: TObject; AData: PtrInt);
+procedure TCustomBCPanel.OnChangeFont(Sender: TObject; AData: BGRAPtrInt);
 begin
   RenderControl;
   Invalidate;
@@ -392,7 +407,9 @@ end;
 
 procedure TCustomBCPanel.TextChanged;
 begin
+  {$IFDEF FPC}
   inherited TextChanged;
+  {$ENDIF}
 
   RenderControl;
   Invalidate;
@@ -401,16 +418,21 @@ end;
 constructor TCustomBCPanel.Create(TheOwner: TComponent);
 begin
   inherited Create(TheOwner);
-  {$IFDEF DEBUG}
+  {$IFDEF INDEBUG}
   FRenderCount := 0;
   {$ENDIF}
+  {$IFDEF FPC}
   DisableAutoSizing;
   Include(FControlState, csCreating);
+  {$ELSE} //#
+
+  {$ENDIF}
+
   BeginUpdate;
   try
     ControlStyle := ControlStyle + [csAcceptsControls, csCaptureMouse,
-      csClickEvents, csSetCaption, csDoubleClicks, csReplicatable,
-      csNoFocus, csAutoSize0x0]
+      csClickEvents, csSetCaption, csDoubleClicks, csReplicatable{$IFDEF FPC},
+      csNoFocus, csAutoSize0x0{$ENDIF}]
       - [csOpaque]; // we need the default background
     //Self.DoubleBuffered := True;
     with GetControlClassDefaultSize do
@@ -427,20 +449,25 @@ begin
     ParentColor         := True;
     UseDockManager      := True;
 
-    FBackground.OnChange := @OnChangeProperty;
-    FBorder.OnChange     := @OnChangeProperty;
-    FFontEx.OnChange     := @OnChangeFont;
+    FBackground.OnChange := OnChangeProperty;
+    FBorder.OnChange     := OnChangeProperty;
+    FFontEx.OnChange     := OnChangeFont;
 
     FBackground.Style   := bbsColor;
     FBackground.Color   := {$ifdef UseCLDefault}clDefault{$else}clBtnFace{$endif};
     FBorder.Style       := bboNone;
 
     FRounding           := TBCRounding.Create(Self);
-    FRounding.OnChange  := @OnChangeProperty;
+    FRounding.OnChange  := OnChangeProperty;
   finally
+    {$IFDEF FPC}
     EnableAutoSizing;
+    {$ENDIF}
     EndUpdate;
+    {$IFDEF FPC}
     Exclude(FControlState, csCreating);
+    {$ELSE} //#
+    {$ENDIF}
   end;
 end;
 
@@ -459,7 +486,7 @@ begin
   Render;
   inherited UpdateControl; // invalidate
 end;
-
+{$IFDEF FPC}
 procedure TCustomBCPanel.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -480,11 +507,12 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
 end;
+{$ENDIF}
 
 procedure TCustomBCPanel.OnFindClass(Reader: TReader; const AClassName: string;
   var ComponentClass: TComponentClass);

+ 22 - 5
bcradialprogressbar.pas

@@ -1,11 +1,17 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCRadialProgressBar;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, BCBaseCtrls,
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF} Forms, Controls, Graphics, Dialogs, BCBaseCtrls,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
   BGRABitmap, BGRABitmapTypes, BGRATextFX;
 
 type
@@ -66,7 +72,7 @@ type
     property LineColor: TColor read FLineColor write SetFLineColor default clBlack;
     property LineBkgColor: TColor read FLineBkgColor write SetFLineBkgColor default
       clSilver;
-    property LineWidth: single read FLineWidth write SetLineWidth default 4;
+    property LineWidth: single read FLineWidth write SetLineWidth {$IFDEF FPC}default 4{$ENDIF};
     property FontShadowColor: TColor read FFontShadowColor
       write SetFFontShadowColor default clBlack;
     property FontShadowOffsetX: integer read FFontShadowOffsetX
@@ -78,15 +84,19 @@ type
     property Font;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
+  {$IFDEF FPC}
   {$I icons\bcradialprogressbar_icon.lrs}
+  {$ENDIF}
   RegisterComponents('BGRA Controls', [TBCRadialProgressBar]);
 end;
+{$ENDIF}
 
 { TBCRadialProgressBar }
 
@@ -201,6 +211,9 @@ end;
 
 procedure TBCRadialProgressBar.DrawControl;
 begin
+  {$IFNDEF FPC}//# //@  IN DELPHI RenderControl NEDD. IF NO RenderControl BE BLACK AFTER INVALIDATE.
+  RenderControl;
+  {$ENDIF}
   FBitmap.Draw(Canvas, 0, 0, False);
 end;
 
@@ -238,7 +251,10 @@ begin
   FBitmap.Canvas2D.strokeStyle(LineColor);
   FBitmap.Canvas2D.stroke;
 
-  textStr := FloatToStr((Value / MaxValue) * 100) + '%';
+  if MaxValue = 0 then
+    textStr := '0%'
+  else
+    textStr := FloatToStr((Value / MaxValue) * 100) + '%';
 
   textBmp := TextShadow(Width, Height, textStr, Font.Height,
     Font.Color, FontShadowColor, FontShadowOFfsetX,
@@ -250,6 +266,7 @@ end;
 constructor TBCRadialProgressBar.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, 200, 200);
   FMaxValue := 100;

+ 61 - 0
bcreg.pas

@@ -0,0 +1,61 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+unit bcReg;
+
+{$I bgracontrols.inc}
+
+interface
+
+uses
+  Classes, SysUtils, BCBaseCtrls,
+  BCButton, BCButtonFocus, BCEffect, bcfilters, BCGameGrid, BCImageButton,
+  BCLabel, BCListBox, BCMaterialDesignButton, BCPanel, BCRadialProgressBar,
+  BCRTTI, BCSamples, BCStylesForm, BCSVGButton, BCSVGViewer, BCToolBar,
+  BCTrackbarUpdown, BGRAFlashProgressBar, BGRAGraphicControl,
+  BGRAImageList, BGRAImageManipulation, BGRAKnob, BGRAResizeSpeedButton,
+  BGRAShape, BGRASpeedButton, BGRASpriteAnimation, BGRAVirtualScreen,
+  ColorSpeedButton, DTAnalogClock, DTAnalogGauge, dtthemedclock,
+  dtthemedgauge, MaterialColors, bcmdbutton, bcmdbuttonfocus;
+
+procedure Register;
+
+implementation
+
+procedure Register;
+begin
+  {$IFDEF FPC}//#
+  {$I images\bgracontrols_images.lrs}
+  {$I icons\BGRAImageManipulation_icon.lrs}
+  {$I icons\bcsvgbutton.lrs}
+  {$I icons\bcimagebutton_icon.lrs}
+  {$I icons\bcgamegrid_icon.lrs}
+  {$I icons\bcradialprogressbar_icon.lrs}
+  {$ENDIF}
+
+  RegisterNoIcon([TBCCustomControl]);
+//  RegisterComponents('BGRA Custom Drawn', [TBCDButton, TBCDEdit,
+//    TBCDStaticText, TBCDProgressBar, TBCDSpinEdit, TBCDCheckBox, TBCDRadioButton, TBCDPanel]);
+
+  RegisterComponents('BGRA Controls', [TBGRAShape, TBCListBox, TBCPaperPanel, TBCPaperListBox,
+  TBCButton, TBCButtonFocus, TDTThemedGauge, TBCLabel, TBCImageButton, TBCXButton, TBCGameGrid,
+  TDTThemedClock, TDTAnalogGauge, TDTAnalogClock, TColorSpeedButton,
+  TBGRAVirtualScreen, TBGRASpriteAnimation, TBGRASpeedButton, TBGRAResizeSpeedButton,
+  TBGRAKnob, TBGRAImageManipulation, TBGRAImageList, TBGRAGraphicControl, TBGRAFlashProgressBar,
+  TBCTrackbarUpdown, TBCToolBar, TBCSVGViewer, TBCSVGButton, TBCRadialProgressBar,
+  TBCPanel,TBCMDButtonFocus, TBCMDButton, TBCMaterialDesignButton
+  {TBCDefaultThemeManager, TBCKeyboard, TBCNumericKeyboard, TBCRealNumericKeyboard}]);
+
+
+{$IFDEF FPC}
+   RegisterPropertyEditor(TypeInfo(TBCListBox),TBCPaperListBox, 'ListBox', TClassPropertyEditor);
+   RegisterPropertyEditor(TypeInfo(integer), TBCButton,'ImageIndex', TBCButtonImageIndexPropertyEditor);
+   RegisterPropertyEditor(TypeInfo(integer), TBCButtonFocus,'ImageIndex', TBCButtonImageIndexPropertyEditor);
+   RegisterPropertyEditor(TypeInfo(TBCListBox), TBCPaperListBox, 'ListBox', TClassPropertyEditor);
+{$ENDIF}
+end;
+
+end.
+

+ 39 - 1
bcrtti.pas

@@ -40,9 +40,14 @@
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCRTTI;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
@@ -87,6 +92,39 @@ const
   sSECTION_HEADER = '['+sSECTION_HEADER_NAME+']';
   sSECTION_PROP   = '['+sSECTION_PROP_NAME+']';
 
+procedure RemovePadChars(var S: String; const CSet: TSysCharset);
+var
+  I,J,K: LONGINT;
+begin
+ I:=Length(S);
+ IF (I>0) Then
+  Begin
+   J:=I;
+   While (j>0) and (S[J] IN CSet) DO DEC(J);
+   if j=0 Then
+     begin
+       s:='';
+       exit;
+     end;
+   k:=1;
+   While (k<=I) And (S[k] IN CSet) DO
+     INC(k);
+   IF k>1 Then
+     begin
+       move(s[k],s[1],j-k+1);
+       setlength(s,j-k+1);
+     end
+   else
+     setlength(s,j);
+  end;
+end;
+
+function TrimSet(const S: String;const CSet:TSysCharSet): String;
+begin
+  result:=s;
+  RemovePadChars(result,cset);
+end;
+
 function IsPropIgnored(const AName: String): Boolean;
 var
   i: Integer;

+ 37 - 27
bcsamples.pas

@@ -1,15 +1,25 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCSamples;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
   Classes, Controls, Graphics,
-  StdCtrls, LCLProc, LCLType, LazUTF8,
-  BCButton, BCButtonFocus, BCTypes,
-  BGRABitmap, BGRABitmapTypes, BGRAGradients, MaterialColors,
-  BCBrightAndContrast;
+  {$IFDEF FPC}LCLProc, LCLType, LazUTF8,{$ENDIF}
+  StdCtrls, BCButton, BCButtonFocus, BCTypes,
+  {$IFNDEF FPC}Types, Windows, Sysutils, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BGRABitmap, BGRABitmapTypes, BGRAGradients, MaterialColors, BCBrightAndContrast;
+
+{$IFNDEF FPC}
+type
+  TWinControlHack = class(TWinControl);
+{$ENDIF}
 
 const
   {Accent Colors}
@@ -139,33 +149,33 @@ procedure BCSampleStyleStrList(s: TStrings);
 function StrToTBCSampleDrawing(const s: ansistring): TBCSampleDrawing;
 procedure BCSampleDrawingStrList(s: TStrings);
 
-procedure StyleButtons(AControl: TControl; AButton: TBCButton);
-procedure StyleButtons(AControl: TControl; AButton: TBCButtonFocus);
+procedure StyleButtons(AControl: TControl; AButton: TBCButton); overload;
+procedure StyleButtons(AControl: TControl; AButton: TBCButtonFocus); overload;
 procedure StyleButtonsSample(AControl: TControl; AStyle: TBCSampleStyle);
 procedure StyleButtonsFocusSample(AControl: TControl; AStyle: TBCSampleStyle);
 
 procedure DrawSample(ABitmap: TBGRABitmap; Element: TBCSampleDrawing;
-  Align: TAlign = alNone);
+  Align: TAlign = alNone); overload;
 function DrawSample(AWidth, AHeight: integer; Element: TBCSampleDrawing;
-  Align: TAlign = alNone): TBGRABitmap;
+  Align: TAlign = alNone): TBGRABitmap; overload;
 procedure DrawItem(Control: TWinControl; Index: integer; ARect: TRect;
   State: TOwnerDrawState; Style: TBCSampleDrawing);
 
 { Buttons }
-procedure BCButtonWindows7(AButton: TBCButton);
-procedure BCButtonWindows7ToolBar(AButton: TBCButton);
-procedure BCButtonOffice2010(AButton: TBCButton);
-procedure BCButtonFlashPlayer(AButton: TBCButton);
-procedure BCButtonMacOSXLion(AButton: TBCButton);
-procedure BCButtonWindows8(AButton: TBCButton; cl1, cl2: TColor; rounding: integer = 1);
-
-procedure BCButtonWindows7(AButton: TBCButtonFocus);
-procedure BCButtonWindows7ToolBar(AButton: TBCButtonFocus);
-procedure BCButtonOffice2010(AButton: TBCButtonFocus);
-procedure BCButtonFlashPlayer(AButton: TBCButtonFocus);
-procedure BCButtonMacOSXLion(AButton: TBCButtonFocus);
+procedure BCButtonWindows7(AButton: TBCButton); overload;
+procedure BCButtonWindows7ToolBar(AButton: TBCButton); overload;
+procedure BCButtonOffice2010(AButton: TBCButton); overload;
+procedure BCButtonFlashPlayer(AButton: TBCButton); overload;
+procedure BCButtonMacOSXLion(AButton: TBCButton); overload;
+procedure BCButtonWindows8(AButton: TBCButton; cl1, cl2: TColor; rounding: integer = 1); overload;
+
+procedure BCButtonWindows7(AButton: TBCButtonFocus); overload;
+procedure BCButtonWindows7ToolBar(AButton: TBCButtonFocus);overload;
+procedure BCButtonOffice2010(AButton: TBCButtonFocus);overload;
+procedure BCButtonFlashPlayer(AButton: TBCButtonFocus);overload;
+procedure BCButtonMacOSXLion(AButton: TBCButtonFocus);overload;
 procedure BCButtonWindows8(AButton: TBCButtonFocus; cl1, cl2: TColor;
-  rounding: integer = 1);
+  rounding: integer = 1); overload;
 
 { Drawings }
 procedure DrawFlashPlayerBody(ABitmap: TBGRABitmap);
@@ -185,9 +195,9 @@ var
   ls: ansistring;
 begin
   Result := ssDefault;
-  ls := UTF8LowerCase(s);
+  ls := {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(s);
   for ss := low(TBCSampleStyle) to high(TBCSampleStyle) do
-    if ls = UTF8LowerCase(BCSampleStyleStr[ss]) then
+    if ls = {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(BCSampleStyleStr[ss]) then
     begin
       Result := ss;
       break;
@@ -404,7 +414,7 @@ begin
     str := TComboBox(Control).Items[Index];
 
   temp := TBGRABitmap.Create(ARect.Right - ARect.Left, ARect.Bottom -
-    ARect.Top, Control.Color);
+    ARect.Top, {$IFNDEF FPC}TWinControlHack(Control).{$ELSE}Control.{$ENDIF}Color);
 
   temp.FontAntialias := True;
   temp.FontHeight := 0;
@@ -1118,9 +1128,9 @@ var
   ls: ansistring;
 begin
   Result := sdDefault;
-  ls := UTF8LowerCase(s);
+  ls := {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(s);
   for ss := low(TBCSampleDrawing) to high(TBCSampleDrawing) do
-    if ls = UTF8LowerCase(BCSampleDrawingStr[ss]) then
+    if ls = {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(BCSampleDrawingStr[ss]) then
     begin
       Result := ss;
       break;

+ 63 - 7
bcstylesform.pas

@@ -28,15 +28,24 @@
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCStylesForm;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
-  StdCtrls, ActnList, ComCtrls, Buttons, ComponentEditors, PropEdits,
+  Classes, SysUtils, {$IFDEF FPC}FileUtil, ComponentEditors, PropEdits,{$ELSE}
+  Windows, DesignIntf, DesignEditors, PropertyCategories,
+  ToolIntf, ExptIntf, DesignWindows,
+  {$ENDIF}
+  Forms, Controls, Graphics, Dialogs, ExtCtrls,
+  StdCtrls, ActnList, ComCtrls, Buttons,
   bcbasectrls;
 
 type
@@ -104,7 +113,7 @@ type
 
   { TBCSylePropertyEditor }
 
-  TBCSylePropertyEditor = class(TClassPropertyEditor)
+  TBCSylePropertyEditor = class({$IFDEF FPC}TClassPropertyEditor{$ELSE}TPropertyEditor{$ENDIF})
   private
     procedure BeginUpdate;
     procedure EndUpdate;
@@ -117,7 +126,11 @@ type
 
 implementation
 
+{$IFDEF FPC}
 uses MacroIntf, BCRTTI, IDEImagesIntf;
+{$ELSE}
+uses BCRTTI;
+{$ENDIF}
 
 { TBCSylePropertyEditor }
 
@@ -155,8 +168,13 @@ var f: TBCfrmStyle;
 begin
   if GetStyleExtension='' then
   begin
+    {$IFDEF FPC}
     MessageDlg('Empty ext', Format('Class %s has empty style extension',
       [GetComponent(0).ClassName]),mtError,[mbOK],0);
+    {$ELSE}
+    MessageDlg('Empty ext' + #10#13 + Format('Class %s has empty style extension',
+      [GetComponent(0).ClassName]),mtError,[mbOK],0);
+    {$ENDIF}
     Exit;
   end;
 
@@ -218,7 +236,11 @@ begin
   begin
     if FileExists(IncludeTrailingBackslash(GetStylesDir)+ExtractFileName(OpenDialog1.FileName)) then
       raise Exception.Create('This style already exists');
+    {$IFDEF FPC}
     CopyFile(OpenDialog1.FileName,IncludeTrailingBackslash(GetStylesDir)+ExtractFileName(OpenDialog1.FileName));
+    {$ELSE}
+    CopyFile(PWidechar(OpenDialog1.FileName),PWidechar(IncludeTrailingBackslash(GetStylesDir)+ExtractFileName(OpenDialog1.FileName)),False);
+    {$ENDIF}
     ActionRefresh.Execute;
   end;
 end;
@@ -230,14 +252,16 @@ var
   it: TListItem;
   h: TBCStyleHeader;
 begin
+  {$IFDEF FPC}//#
   sl := FindAllFiles(GetStylesDir,'*.'+FStyleExt,False);
+  {$ENDIF}
   try
     lvFiles.ItemIndex := -1;
     lvFiles.Selected := nil;
     lvFiles.Clear;
     if (sl<>nil) and (sl.Count>0) then
     begin
-      lvFiles.BeginUpdate;
+      lvFiles.{$IFNDEF FPC}Items.{$ENDIF}BeginUpdate;
       try
         for i:=0 to Pred(sl.Count) do
         begin
@@ -254,7 +278,7 @@ begin
         lvFilesSelectItem(lvFiles,lvFiles.Selected,True);
         ActionDelete.Enabled := True;
       finally
-        lvFiles.EndUpdate;
+        lvFiles.{$IFNDEF FPC}Items.{$ENDIF}EndUpdate;
       end;
     end else
     begin
@@ -273,7 +297,11 @@ procedure TBCfrmStyle.FormCloseQuery(Sender: TObject; var CanClose: boolean);
 begin
   if (ModalResult=mrOK) and (lvFiles.ItemIndex=-1) then
   begin
+    {$IFDEF FPC}
     MessageDlg('Assign file', 'No style selected', mtError, [mbOK], 0);
+    {$ELSE}
+    MessageDlg('Assign file' + #10#13 + 'No style selected', mtError, [mbOK], 0);
+    {$ENDIF}
     CanClose := False;
   end
   else
@@ -283,13 +311,23 @@ end;
 procedure TBCfrmStyle.ActionDeleteExecute(Sender: TObject);
 begin
   if (lvFiles.SelCount=0) or
+    {$IFDEF FPC}
      (MessageDlg('Deleting style', 'Do you really want to delete selected style? '+
                  'This action delete file: '+IncludeTrailingBackslash(GetStylesDir)+lvFiles.Selected.Caption,
                  mtConfirmation,mbYesNo,0)=mrNo)
+    {$ELSE}
+     (MessageDlg('Deleting style' + #10#13 + 'Do you really want to delete selected style? '+
+                 'This action delete file: '+ IncludeTrailingBackslash(GetStylesDir) + lvFiles.Selected.Caption,
+                 mtConfirmation,mbYesNo,0)=mrNo)
+    {$ENDIF}
   then
     Exit;
 
+  {$IFDEF FPC}
   DeleteFile(IncludeTrailingBackslash(GetStylesDir)+lvFiles.Selected.Caption);
+  {$ELSE}
+  DeleteFile(PWideChar(IncludeTrailingBackslash(GetStylesDir)+lvFiles.Selected.Caption));
+  {$ENDIF}
   ActionRefresh.Execute;
 end;
 
@@ -341,7 +379,9 @@ end;
 function TBCfrmStyle.GetStylesDir: String;
 begin
   Result := '$PkgDir(bgracontrols)';
+  {$IFDEF FPC}
   IDEMacros.SubstituteMacros(Result);
+  {$ENDIF}
   Result := IncludeTrailingBackslash(Result)+'styles';
 end;
 
@@ -351,9 +391,11 @@ begin
   FPreviewControl.Constraints.MinWidth := 100;
   FPreviewControl.Constraints.MinHeight := 100;
   FPreviewControl.Parent := gboxPreview;
+  {$IFDEF FPC}//#
   FPreviewControl.Caption := FControl.Caption;
   if Trim(FPreviewControl.Caption) = '' then
     FPreviewControl.Caption := 'Demo';
+  {$ENDIF}
   FPreviewControl.Visible := False;
 end;
 
@@ -371,12 +413,14 @@ constructor TBCfrmStyle.Create(AControl: TControl;
   // It seems that method LoadImage load icon on each call. Others lazarus
   // component editors doesn't check if icon exist but I will do. Small memory leak
   // reduction :P
+  {$IFDEF FPC}//#
   function _LoadImage(AIdx: Integer; const AName: String): Integer;
   begin
     Result := IDEImages.GetImageIndex(AIdx,AName);
     if Result=-1 then
       Result := IDEImages.LoadImage(AIdx,AName);
   end;
+  {$ENDIF}
 begin
   inherited Create(Application);
 
@@ -386,12 +430,14 @@ begin
   CreatePreviewControl;
   ActionRefresh.Execute;
 
+  {$IFDEF FPC}//#
   ToolBar1.Images               := IDEImages.Images_16;
   ActionList1.Images            := ToolBar1.Images;
   ActionDelete.ImageIndex       := _LoadImage(16,'laz_delete');
   ActionNewFromCtrl.ImageIndex  := _LoadImage(16,'laz_add');
   ActionNewFromFile.ImageIndex  := _LoadImage(16,'laz_open');
   ActionRefresh.ImageIndex      := _LoadImage(16,'laz_refresh');
+  {$ENDIF}
 
   ActionDelete.Enabled    := False;
 
@@ -438,8 +484,13 @@ var f: TBCfrmStyle;
 begin
   if GetStyleExtension='' then
   begin
+    {$IFDEF FPC}
     MessageDlg('Empty ext', Format('Class %s has empty style extension',
       [Component.ClassName]),mtError,[mbOK],0);
+    {$ELSE}
+    MessageDlg('Empty ext' + #10#13 + Format('Class %s has empty style extension',
+      [Component.ClassName]),mtError,[mbOK],0);
+    {$ENDIF}
     Exit;
   end;
 
@@ -477,8 +528,13 @@ begin
 end;
 
 initialization
-  RegisterComponentEditor([TBCStyleGraphicControl, TBCStyleCustomControl], TBCStyleComponentEditor);
+  RegisterComponentEditor(TBCStyleGraphicControl, TBCStyleComponentEditor);
+  RegisterComponentEditor(TBCStyleCustomControl, TBCStyleComponentEditor);
+  {$IFDEF FPC}
   RegisterPropertyEditor(ClassTypeInfo(TBCStyleDummyProperty),nil,'',TBCSylePropertyEditor);
+  {$ELSE}
+  RegisterPropertyEditor(TypeInfo(TBCStyleDummyProperty),nil,'',TBCSylePropertyEditor);
+  {$ENDIF}
 
 end.
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 11 - 3
bcsvgbutton.pas


+ 31 - 20
bcsvgviewer.pas

@@ -1,12 +1,19 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCSVGViewer;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, BGRAGraphicControl,
-  BGRABitmap, BGRABitmapTypes, BGRASVG, BGRAUnits, LCLType, BCTypes;
+  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, BGRAGraphicControl,
+  {$IFDEF FPC}LResources, LCLType, {$ENDIF}
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BGRABitmap, BGRABitmapTypes, BGRASVG, BGRAUnits, BCTypes;
 
 type
 
@@ -47,9 +54,9 @@ type
     property OnRedraw;
     property Bitmap;
     property SVG: TBGRASVG read FSVG;
-    property DestDPI: single read FDestDPI write SetFDestDPI default 96;
-    property x: single read Fx write SetFx default 0;
-    property y: single read Fy write SetFy default 0;
+    property DestDPI: single read FDestDPI write SetFDestDPI {$IFDEF FPC}default 96{$ENDIF};
+    property x: single read Fx write SetFx {$IFDEF FPC}default 0{$ENDIF};
+    property y: single read Fy write SetFy {$IFDEF FPC}default 0{$ENDIF};
     property HorizAlign: TAlignment read FHorizAlign write SetHorizAlign default taCenter;
     property VertAlign: TTextLayout read FVertAlign write SetVertAlign default tlCenter;
     property StretchMode: TBCStretchMode read FStretchMode write SetStretchMode default smStretch;
@@ -64,21 +71,25 @@ type
     property OnMouseLeave;
     property OnMouseMove;
     property OnMouseUp;
+    {$IFDEF FPC}
     property OnPaint;
+    {$ENDIF}
     property OnResize;
     property Caption;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
 uses BGRAVectorize;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   RegisterComponents('BGRA Controls', [TBCSVGViewer]);
 end;
+{$ENDIF}
 
 { TBCSVGViewer }
 
@@ -201,22 +212,22 @@ end;
 
 function TBCSVGViewer.GetSVGRectF: TRectF;
 var
-  vbSize: TPointF;
+  vb: TSVGViewBox;
 
   procedure NoStretch(AX,AY: single);
   begin
     case HorizAlign of
-      taCenter: result.Left := (Width-vbSize.x)/2;
-      taRightJustify: result.Left := Width-AX-vbSize.x;
+      taCenter: result.Left := (Width-vb.size.x)/2;
+      taRightJustify: result.Left := Width-AX-vb.size.x;
       else {taLeftJustify} result.Left := AX;
     end;
     case VertAlign of
-      tlCenter: result.Top := (Height-vbSize.y)/2;
-      tlBottom: result.Top := Height-AY-vbSize.y;
+      tlCenter: result.Top := (Height-vb.size.y)/2;
+      tlBottom: result.Top := Height-AY-vb.size.y;
       else {tlTop} result.Top := AY;
     end;
-    result.Right := result.Left+vbSize.x;
-    result.Bottom := result.Top+vbSize.y;
+    result.Right := result.Left+vb.size.x;
+    result.Bottom := result.Top+vb.size.y;
   end;
 
 begin
@@ -225,10 +236,10 @@ begin
 
   FSVG.Units.ContainerWidth := FloatWithCSSUnit(Width*FSVG.Units.DpiX/DestDPI,cuPixel);
   FSVG.Units.ContainerHeight := FloatWithCSSUnit(Height*FSVG.Units.DpiY/DestDPI,cuPixel);
-  vbSize := FSVG.ViewSizeInUnit[cuPixel];
-  vbSize.x *= DestDPI/FSVG.Units.DpiX;
-  vbSize.y *= DestDPI/FSVG.Units.DpiY;
-  if ((StretchMode = smShrink) and ((vbSize.x > Width+0.1) or (vbSize.y > Height+0.1))) or
+  vb := FSVG.ViewBoxInUnit[cuPixel];
+  vb.size.x := vb.size.x *(DestDPI/FSVG.Units.DpiX);
+  vb.size.y := vb.size.y *(DestDPI/FSVG.Units.DpiY);
+  if ((StretchMode = smShrink) and ((vb.size.x > Width+0.1) or (vb.size.y > Height+0.1))) or
      (StretchMode = smStretch) then
   begin
     if Proportional then
@@ -237,12 +248,12 @@ begin
     if StretchMode = smShrink then
     begin
       NoStretch(0,0);
-      if vbSize.x > Width then
+      if vb.size.x > Width then
       begin
         result.Left := 0;
         result.Right := Width;
       end;
-      if vbSize.y > Height then
+      if vb.size.y > Height then
       begin
         result.Top := 0;
         result.Bottom := Height;

+ 10 - 4
bcthememanager.pas

@@ -1,11 +1,17 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCThemeManager;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;
+  Classes, SysUtils, Forms, Controls, Graphics,
+  {$IFDEF FPC}LResources, {$ELSE}Types, BGRAGraphics, GraphType, FPImage,{$ENDIF} Dialogs;
 
 type
   TBCThemeManager = class(TComponent)
@@ -14,8 +20,8 @@ type
   protected
 
   public
-    procedure Apply(AControl: TWinControl); virtual abstract;
-    procedure Apply(); virtual abstract;
+    procedure Apply(AControl: TWinControl); overload; virtual; abstract;
+    procedure Apply(); overload; virtual; abstract;
   published
 
   end;

+ 36 - 5
bctoolbar.pas

@@ -33,14 +33,20 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCToolBar;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls,
+  Classes, {$IFDEF FPC}LResources,{$ELSE}types, BGRAGraphics, GraphType, FPImage,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs, ComCtrls,
   BGRABitmap, BGRABitmapTypes, BGRAGradients, BCTypes;
 
 type
@@ -56,7 +62,12 @@ type
     procedure SetLimitMemoryUsage(AValue: boolean);
   protected
     { Protected declarations }
-    procedure Paint; override;
+   {$IFDEF FPC}
+   procedure Paint; override;
+   {$ELSE}
+   procedure Paint; virtual;
+   procedure PaintWindow(DC: HDC); override;
+   {$ENDIF}
     procedure CheckMemoryUsage; virtual;
   public
     { Public declarations }
@@ -70,7 +81,7 @@ type
 
 procedure DrawWindows7ToolBar(Bitmap: TBGRABitmap; AColor: TColor = clDefault);
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -79,7 +90,7 @@ var hsla: THSLAPixel;
 begin
   if g_hue = -1 then result := AColor else
     begin
-      hsla := BGRAToGSBA(AColor);
+      hsla := BGRAToHSLA(AColor);
       hsla.hue := g_hue;
       result := GSBAToBGRA(hsla);
     end;
@@ -123,11 +134,13 @@ begin
   Bitmap.HorizLine(ARect.Left, ARect.Bottom - 1, ARect.Right-1, SetHue(BGRA(160, 175, 195), g_hue), dmSet);
 end;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bctoolbar_icon.lrs}
   RegisterComponents('BGRA Controls', [TBCToolBar]);
 end;
+{$ENDIF}
 
 { TBCToolBar }
 
@@ -150,6 +163,24 @@ begin
   CheckMemoryUsage;
 end;
 
+{$IFNDEF FPC}
+procedure TBCToolBar.PaintWindow(DC: HDC);
+begin
+  Canvas.Lock;
+  try
+    Canvas.Handle := DC;
+    try
+      TControlCanvas(Canvas).UpdateTextFlags;
+      Paint;
+    finally
+      Canvas.Handle := 0;
+    end;
+  finally
+    Canvas.Unlock;
+  end;
+end;
+{$ENDIF}
+
 procedure TBCToolBar.Paint;
 begin
   if (FBGRA.Width <> Width) or (FBGRA.Height <> Height) then

+ 11 - 5
bctools.pas

@@ -28,15 +28,21 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCTools;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, Graphics, BGRABitmap, BGRABitmapTypes, bctypes,
-  Controls, BGRAGradientScanner;
+  Classes, SysUtils, Types, Graphics,
+  {$IFDEF FPC}LCLType, LCLIntf,{$ENDIF} {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BGRABitmap, BGRABitmapTypes, bctypes, Controls, BGRAGradientScanner;
 
 // This method prepare BGRABitmap for rendering BCFont type
 procedure AssignBCFont(AFont: TBCFont; out ATargetBGRA: TBGRABitmap);
@@ -76,7 +82,7 @@ function BCAlign2VAlign(AAlign: TBCAlignment): TTextLayout;
 
 implementation
 
-uses Types, BGRAPolygon, BGRAFillInfo, BGRAText, math, LCLType, LCLIntf;
+uses BGRAPolygon, BGRAFillInfo, BGRAText, math;
 
 procedure CalculateBorderRect(ABorder: TBCBorder; var ARect: TRect);
 var w: integer;
@@ -272,7 +278,7 @@ begin
   begin
     // Getting real font name
     if SameText(AFont.Name,'default')
-    then ATargetBGRA.FontName := GetFontData(c.Canvas.Font.Handle).Name
+    then ATargetBGRA.FontName := string(GetFontData(c.Canvas.Font.Handle).Name)
     else ATargetBGRA.FontName := AFont.Name;
 
     // Calculate default height, because when font quality is <> fqSystemXXX

+ 25 - 14
bctrackbarupdown.pas

@@ -33,14 +33,21 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCTrackbarUpdown;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  LCLType, Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
+  {$IFDEF FPC}LCLType, LResources,{$ENDIF}
+  Classes, SysUtils, Types, Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
   ExtCtrls, BGRABitmap, BCBaseCtrls, BCTypes;
 
 type
@@ -98,7 +105,7 @@ type
     procedure MouseDown(Button: TMouseButton; {%H-}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 UTF8KeyPress(var UTF8Key: TUTF8Char); override;
+    procedure UTF8KeyPress(var UTF8Key: {$IFDEF FPC}TUTF8Char{$ELSE}String{$ENDIF}); override;
     procedure DoEnter; override;
     procedure DoExit; override;
   public
@@ -155,6 +162,9 @@ type
     property Anchors;
     property BorderSpacing;
     property ChildSizing;
+    {$IFDEF FPC} //#
+    property OnGetDockCaption;
+    {$ENDIF}
     property ClientHeight;
     property ClientWidth;
     property Constraints;
@@ -182,7 +192,6 @@ type
     property OnEnter;
     property OnExit;
     property OnGetSiteInfo;
-    property OnGetDockCaption;
     property OnMouseDown;
     property OnMouseEnter;
     property OnMouseLeave;
@@ -194,17 +203,19 @@ type
     property OnUnDock;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses BGRABitmapTypes, Types, Math, BCTools;
+uses BGRABitmapTypes, Math, BCTools;
 
+{$IFDEF FPC}
 procedure Register;
 begin
 //{$I icons\bctrackbarupdown_icon.lrs}
   RegisterComponents('BGRA Controls', [TBCTrackbarUpdown]);
 end;
+{$ENDIF}
 
 { TCustomBCTrackbarUpdown }
 
@@ -395,7 +406,7 @@ begin
     FBarHeight := (bounds.bottom-bounds.top+3) div 5+1;
     FBarWidth := bounds.right-FUpDownWidth-FBarHeight+1-FBarLeft;
     if (Rounding.RoundX > 1) and (Rounding.RoundY > 1) then
-      FBarLeft += FBarHeight+1;
+      FBarLeft := FBarLeft +FBarHeight+1;
   end else
   begin
     FBarWidth := 0;
@@ -587,7 +598,7 @@ begin
   end;
 end;
 
-procedure TCustomBCTrackbarUpdown.UTF8KeyPress(var UTF8Key: TUTF8Char);
+procedure TCustomBCTrackbarUpdown.UTF8KeyPress(var UTF8Key: {$IFDEF FPC}TUTF8Char{$ELSE}String{$ENDIF});
 var tempText: string;
 begin
   FHandlingUserInput:= true;
@@ -651,7 +662,7 @@ begin
   FBarExponent:= 1;
   FTimer := TTimer.Create(self);
   FTimer.Enabled := false;
-  FTimer.OnTimer:=@Timer;
+  FTimer.OnTimer:=Timer;
   FLongTimeInterval:= 400;
   FShortTimeInterval:= 100;
   FHasTrackBar:= true;
@@ -659,15 +670,15 @@ begin
   FBCBorder.Color := clWindowText;
   FBCBorder.Width := 1;
   FBCBorder.Style := bboSolid;
-  FBCBorder.OnChange := @OnChangeProperty;
+  FBCBorder.OnChange := OnChangeProperty;
   FBCRounding := TBCRounding.Create(self);
   FBCRounding.RoundX := 1;
   FBCRounding.RoundY := 1;
-  FBCRounding.OnChange := @OnChangeProperty;
+  FBCRounding.OnChange := OnChangeProperty;
   FBCBackground := TBCBackground.Create(self);
   FBCBackground.Style := bbsColor;
   FBCBackground.Color := clWindow;
-  FBCBackground.OnChange := @OnChangeProperty;
+  FBCBackground.OnChange := OnChangeProperty;
   FBCButtonBackground := TBCBackground.Create(self);
   FBCButtonBackground.Style := bbsGradient;
   FBCButtonBackground.Gradient1EndPercent := 50;
@@ -679,11 +690,11 @@ begin
   FBCButtonBackground.Gradient2.Point2YPercent := 150;
   FBCButtonBackground.Gradient2.StartColor := clBtnFace;
   FBCButtonBackground.Gradient2.EndColor := clBtnShadow;
-  FBCButtonBackground.OnChange := @OnChangeProperty;
+  FBCButtonBackground.OnChange := OnChangeProperty;
   FBCButtonDownBackground := TBCBackground.Create(self);
   FBCButtonDownBackground.Style := bbsColor;
   FBCButtonDownBackground.Color := clBtnShadow;
-  FBCButtonDownBackground.OnChange := @OnChangeProperty;
+  FBCButtonDownBackground.OnChange := OnChangeProperty;
   FArrowColor:= clBtnText;
   Font.Color := clWindowText;
   Font.Name := 'Arial';

+ 98 - 11
bctypes.pas

@@ -27,16 +27,103 @@
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BCTypes;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, Controls, BGRABitmap, BGRABitmapTypes, Graphics, BCBasectrls;
+  Classes, Controls, {$IFNDEF FPC}Types, Windows, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BGRABitmap, BGRABitmapTypes, Graphics, BCBasectrls;
 
 type
+
+  {$IFDEF FPC}
+    {$IFDEF CPU64}
+    BGRAPtrInt      = PtrInt;           //    Cardinal;//PtrInt;
+    BGRAPtrUInt     = PtrUInt;          //    Cardinal;//PtrUInt;
+    {$ELSE}
+    BGRAPtrInt      = PtrInt;           //    LongInt;//PtrInt;
+    BGRAPtrUInt     = PtrUInt;          //    Cardinal;//PtrUInt;
+    BGRAQWord       = Int64;            //    Cardinal;//QWord;
+    {$ENDIF}
+    BGRAWord        = Word;                        //    Word;
+    PBGRAWord       = PWord;                       //    PWord;
+    BGRADWord       = DWord;          //    Cardinal;  //DWord;
+    BGRALongWord    = LongWord;       //    Cardinal;  //LongWord;
+    PBGRAQWord      = PQWord;         //    PCardinal; //PQWord;
+    PBGRADWord      = PDWord;         //    PCardinal; //PDWord;
+    PBGRALongWord   = PLongWord;      //    PCardinal; //PLongWord;
+    BGRANativeInt   = NativeInt;      //    NativeInt;  //NativeInt;
+    BGRANativeUInt  = NativeUInt;     //    Cardinal;  //NativeUInt;
+    BGRALongInt     = LongInt;        //    Cardinal;  //LongInt;
+    BGRAInt64       = Int64;                       //    Int64;
+    BGRAUInt64      = Int64;                      //    UInt64;
+    BGRACardinal    = Cardinal;                    //    Cardinal;
+    PBGRACardinal   = PCardinal;                   //    PCardinal;
+
+    HDC             = {$IFDEF BGRABITMAP_USE_LCL}LCLType.HDC{$ELSE}BGRAPtrUInt{$ENDIF};
+    PPTrint         = ^PtrInt;
+  {$ELSE}
+    ValReal         = Extended;
+    {$IFDEF CPU64}
+    BGRAPtrInt      = Int64;
+    BGRAPtrUInt     = QWord;
+    {$ELSE}
+    BGRAPtrInt      = LongInt;        //      LongInt;//LongInt;
+    BGRAPtrUInt     = LongWord;       //      Cardinal;//LongWord;
+    BGRAQWord       = Int64;          //      Cardinal;//LongWord;
+    {$ENDIF}
+    BGRAWord        = Word;           //                 Word;
+    PBGRAWord       = PWord;          //                 PWord;
+    BGRADWord       = DWord;          //      Cardinal;//DWord;
+    BGRALongWord    = LongWord;       //      Cardinal;//LongWord;
+    PBGRAPtrInt     = ^BGRAPtrInt;    //     PCardinal;//^BGRAPtrInt;
+    PBGRAPtrUInt    = ^BGRAPtrUInt;   //     PCardinal;//^BGRAPtrUInt;
+    PBGRAQWord      = ^BGRAQWord;     //     PCardinal;//^BGRAQWord;
+    PBGRADWord      = PDWord;         //     PCardinal;//PDWord;
+    PBGRALongWord   = PLongWord;      //     PCardinal;//PLongWord;
+    BGRANativeInt   = NativeInt;      //     NativeInt;//NativeInt;
+    BGRANativeUInt  = NativeUInt;     //      Cardinal;//NativeUInt;
+    BGRALongInt     = LongInt;        //                 LongInt;
+    BGRAInt64       = Int64;          //                 Int64;
+    BGRAUInt64      = Int64;          //                 UInt64;
+    BGRACardinal    = Cardinal;       //                 Cardinal;
+    PBGRACardinal   = PCardinal;      //                 PCardinal;
+
+    HDC             = Windows.HDC;    //
+    PUnicodeChar    = Windows.PWChar; //
+    UnicodeChar     = Windows.WCHAR;  //
+(*    ValReal         = FPImage.ValReal;
+    {$IFDEF CPU64}     //WORD = 2 bytes = 4 nybbles = 16 bits    for 32bits
+    BGRAPtrInt      = FPImage.BGRAPtrInt;
+    BGRAPtrUInt     = FPImage.BGRAPtrUInt;  //QWORD = 2 DWORDs = 4 WORDs = ….. = 64 bits       for 32bits
+    {$ELSE}               //BGRADWord = 2 WORDs = 4 bytes = 8 nybbles = 32 bits   for 32bits
+    BGRAPtrInt      = FPImage.BGRAPtrInt;
+    BGRAPtrUInt     = FPImage.BGRAPtrUInt;
+    BGRAQWord       = FPImage.BGRAQWord;
+    {$ENDIF}
+    BGRADWord       = FPImage.BGRADWord;
+    BGRALongWord    = FPImage.BGRALongWord;
+    PBGRAPtrInt     = FPImage.PBGRAPtrInt;
+    PBGRAPtrUInt    = FPImage.PBGRAPtrUInt;
+    PBGRAQWord      = FPImage.PBGRAQWord;
+    PBGRADWord      = FPImage.PBGRADWord;
+    HDC             = FPImage.HDC;
+    BGRANativeInt   = FPImage.BGRANativeInt;
+    PBGRALongWord   = FPImage.PBGRALongWord;
+
+    PUnicodeChar    = FPImage.PUnicodeChar;
+    UnicodeChar     = FPImage.UnicodeChar;    *)
+  {$ENDIF}
+
+
   TBCMouseState = (msNone, msHover, msClicked);
   TBCAlignment = (bcaLeftTop, bcaLeftCenter, bcaLeftBottom,
     bcaCenterTop, bcaCenter, bcaCenterBottom, bcaRightTop, bcaRightCenter,
@@ -244,14 +331,14 @@ type
     FPixel: TBGRAPixel;
   public
     { Constructor }
-    constructor Create(AControl: TControl); override;
-    constructor Create(AControl: TControl; APixel: TBGRAPixel);
-    constructor Create(AControl: TControl; AColor: TColor);
+    constructor Create(AControl: TControl); overload; override;
+    constructor Create(AControl: TControl; APixel: TBGRAPixel); overload;
+    constructor Create(AControl: TControl; AColor: TColor); overload;
     { Assign values to Pixel }
-    procedure Assign(Source: TPersistent); override;
-    procedure Assign(Source: TBGRAPixel);
-    procedure Assign(Source: TColor; Opacity: byte = 255);
-    procedure Assign(Source: string);
+    procedure Assign(Source: TPersistent); overload;  override;
+    procedure Assign(Source: TBGRAPixel); overload;
+    procedure Assign(Source: TColor; Opacity: byte = 255);overload;
+    procedure Assign(Source: string); overload;
     { Read values }
     property Pixel: TBGRAPixel read FPixel write FPixel;
     function Color: TColor;
@@ -767,8 +854,8 @@ begin
   FGradient2 := TBCGradient.Create(AControl);
   FGradient1EndPercent := 35;
 
-  FGradient1.OnChange := @OnChangeChildProperty;
-  FGradient2.OnChange := @OnChangeChildProperty;
+  FGradient1.OnChange := OnChangeChildProperty;
+  FGradient2.OnChange := OnChangeChildProperty;
   inherited Create(AControl);
 end;
 

+ 93 - 0
bgracontrols.dpk

@@ -0,0 +1,93 @@
+package bgracontrols;
+
+{$R *.res}
+{$R 'icons\BGRAImageManipulation_icon.res'}
+{$R 'icons\bcsvgbutton.res'}
+{$R 'icons\bcimagebutton_icon.res'}
+{$R 'icons\bcgamegrid_icon.res'}
+{$R 'icons\bcradialprogressbar_icon.res'}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION OFF}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES ON}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DEFINE DEBUG}
+{$ENDIF IMPLICITBUILDING}
+{$DESIGNONLY}
+{$IMPLICITBUILD ON}
+
+requires
+  designide,
+  rtl,
+  vcl,
+  vcldesigner,
+  vclimg,
+  bgrabitmappack;
+
+contains
+  bcbasectrls in 'bcbasectrls.pas',
+  bcbrightandcontrast in 'bcbrightandcontrast.pas',
+  bcbutton in 'bcbutton.pas',
+  bcbuttonfocus in 'bcbuttonfocus.pas',
+  bceffect in 'bceffect.pas',
+  bcfilters in 'bcfilters.pas',
+  bcgamegrid in 'bcgamegrid.pas',
+  bcimagebutton in 'bcimagebutton.pas',
+  bckeyboard in 'bckeyboard.pas',
+  bclabel in 'bclabel.pas',
+  bcmaterialdesignbutton in 'bcmaterialdesignbutton.pas',
+  bcmdbutton in 'bcmdbutton.pas',
+  bcmdbuttonfocus in 'bcmdbuttonfocus.pas',
+  bcnumerickeyboard in 'bcnumerickeyboard.pas',
+  bcpanel in 'bcpanel.pas',
+  bcradialprogressbar in 'bcradialprogressbar.pas',
+  bcrtti in 'bcrtti.pas',
+  bcsamples in 'bcsamples.pas',
+  bcstylesform in 'bcstylesform.pas',
+  bcsvgbutton in 'bcsvgbutton.pas',
+  bcsvgviewer in 'bcsvgviewer.pas',
+  bcthememanager in 'bcthememanager.pas',
+  bctoolbar in 'bctoolbar.pas',
+  bctools in 'bctools.pas',
+  bctrackbarupdown in 'bctrackbarupdown.pas',
+  bctypes in 'bctypes.pas',
+  bgraflashprogressbar in 'bgraflashprogressbar.pas',
+  bgragraphiccontrol in 'bgragraphiccontrol.pas',
+  bgraimagelist in 'bgraimagelist.pas',
+  bgraimagemanipulation in 'bgraimagemanipulation.pas',
+  bgraknob in 'bgraknob.pas',
+  bgraresizespeedbutton in 'bgraresizespeedbutton.pas',
+  bgrashape in 'bgrashape.pas',
+  bgraspeedbutton in 'bgraspeedbutton.pas',
+  bgraspriteanimation in 'bgraspriteanimation.pas',
+  bgravirtualscreen in 'bgravirtualscreen.pas',
+  colorspeedbutton in 'colorspeedbutton.pas',
+  dtanalogclock in 'dtanalogclock.pas',
+  dtthemedclock in 'dtthemedclock.pas',
+  materialcolors in 'materialcolors.pas',
+  MouseAndKeyInput in 'lcl\MouseAndKeyInput.pas',
+  MouseInputIntf in 'lcl\MouseInputIntf.pas',
+  KeyInputIntf in 'lcl\KeyInputIntf.pas',
+  WinMouseInput in 'lcl\WinMouseInput.pas',
+  WinKeyInput in 'lcl\WinKeyInput.pas',
+  bcreg in 'bcreg.pas';
+
+end.
+

+ 225 - 0
bgracontrols.dproj

@@ -0,0 +1,225 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+    <PropertyGroup>
+        <ProjectGuid>{D31721D7-6E5F-4AB7-922D-D08C063CA1B6}</ProjectGuid>
+        <MainSource>bgracontrols.dpk</MainSource>
+        <ProjectVersion>18.4</ProjectVersion>
+        <FrameworkType>VCL</FrameworkType>
+        <Base>True</Base>
+        <Config Condition="'$(Config)'==''">Debug</Config>
+        <Platform Condition="'$(Platform)'==''">Win32</Platform>
+        <TargetedPlatforms>1</TargetedPlatforms>
+        <AppType>Package</AppType>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
+        <Base_Android>true</Base_Android>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+        <Base_Win32>true</Base_Win32>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
+        <Base_Win64>true</Base_Win64>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
+        <Cfg_1>true</Cfg_1>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
+        <Cfg_1_Win32>true</Cfg_1_Win32>
+        <CfgParent>Cfg_1</CfgParent>
+        <Cfg_1>true</Cfg_1>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
+        <Cfg_2>true</Cfg_2>
+        <CfgParent>Base</CfgParent>
+        <Base>true</Base>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base)'!=''">
+        <DesignOnlyPackage>true</DesignOnlyPackage>
+        <DCC_UsePackage>rtl;$(DCC_UsePackage)</DCC_UsePackage>
+        <DCC_CBuilderOutput>All</DCC_CBuilderOutput>
+        <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
+        <GenPackage>true</GenPackage>
+        <GenDll>true</GenDll>
+        <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
+        <DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
+        <SanitizedProjectName>bgracontrols</SanitizedProjectName>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Android)'!=''">
+        <VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
+        <BT_BuildType>Debug</BT_BuildType>
+        <EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar</EnabledSysJars>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win32)'!=''">
+        <DCC_UsePackage>vclimg;vcl;bgrabitmappack;$(DCC_UsePackage)</DCC_UsePackage>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Base_Win64)'!=''">
+        <DCC_UsePackage>vclimg;vcl;$(DCC_UsePackage)</DCC_UsePackage>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1)'!=''">
+        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+        <DCC_Optimize>false</DCC_Optimize>
+        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+        <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
+        <DCC_RemoteDebug>true</DCC_RemoteDebug>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
+        <DCC_UnitSearchPath>C:\BGRABitmap\Win32\Debug;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
+        <DCC_CBuilderOutput>None</DCC_CBuilderOutput>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <DCC_RemoteDebug>false</DCC_RemoteDebug>
+    </PropertyGroup>
+    <PropertyGroup Condition="'$(Cfg_2)'!=''">
+        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+        <DCC_DebugInformation>0</DCC_DebugInformation>
+    </PropertyGroup>
+    <ItemGroup>
+        <DelphiCompile Include="$(MainSource)">
+            <MainSource>MainSource</MainSource>
+        </DelphiCompile>
+        <DCCReference Include="icons\BGRAImageManipulation_icon.res"/>
+        <DCCReference Include="icons\bcsvgbutton.res"/>
+        <DCCReference Include="icons\bcimagebutton_icon.res"/>
+        <DCCReference Include="icons\bcgamegrid_icon.res"/>
+        <DCCReference Include="icons\bcradialprogressbar_icon.res"/>
+        <DCCReference Include="designide.dcp"/>
+        <DCCReference Include="rtl.dcp"/>
+        <DCCReference Include="vcl.dcp"/>
+        <DCCReference Include="vcldesigner.dcp"/>
+        <DCCReference Include="vclimg.dcp"/>
+        <DCCReference Include="bgrabitmappack.dcp"/>
+        <DCCReference Include="bcbasectrls.pas"/>
+        <DCCReference Include="bcbrightandcontrast.pas"/>
+        <DCCReference Include="bcbutton.pas"/>
+        <DCCReference Include="bcbuttonfocus.pas"/>
+        <DCCReference Include="bceffect.pas"/>
+        <DCCReference Include="bcfilters.pas"/>
+        <DCCReference Include="bcgamegrid.pas"/>
+        <DCCReference Include="bcimagebutton.pas"/>
+        <DCCReference Include="bckeyboard.pas"/>
+        <DCCReference Include="bclabel.pas"/>
+        <DCCReference Include="bcmaterialdesignbutton.pas"/>
+        <DCCReference Include="bcmdbutton.pas"/>
+        <DCCReference Include="bcmdbuttonfocus.pas"/>
+        <DCCReference Include="bcnumerickeyboard.pas"/>
+        <DCCReference Include="bcpanel.pas"/>
+        <DCCReference Include="bcradialprogressbar.pas"/>
+        <DCCReference Include="bcrtti.pas"/>
+        <DCCReference Include="bcsamples.pas"/>
+        <DCCReference Include="bcstylesform.pas"/>
+        <DCCReference Include="bcsvgbutton.pas"/>
+        <DCCReference Include="bcsvgviewer.pas"/>
+        <DCCReference Include="bcthememanager.pas"/>
+        <DCCReference Include="bctoolbar.pas"/>
+        <DCCReference Include="bctools.pas"/>
+        <DCCReference Include="bctrackbarupdown.pas"/>
+        <DCCReference Include="bctypes.pas"/>
+        <DCCReference Include="bgraflashprogressbar.pas"/>
+        <DCCReference Include="bgragraphiccontrol.pas"/>
+        <DCCReference Include="bgraimagelist.pas"/>
+        <DCCReference Include="bgraimagemanipulation.pas"/>
+        <DCCReference Include="bgraknob.pas"/>
+        <DCCReference Include="bgraresizespeedbutton.pas"/>
+        <DCCReference Include="bgrashape.pas"/>
+        <DCCReference Include="bgraspeedbutton.pas"/>
+        <DCCReference Include="bgraspriteanimation.pas"/>
+        <DCCReference Include="bgravirtualscreen.pas"/>
+        <DCCReference Include="colorspeedbutton.pas"/>
+        <DCCReference Include="dtanalogclock.pas"/>
+        <DCCReference Include="dtthemedclock.pas"/>
+        <DCCReference Include="materialcolors.pas"/>
+        <DCCReference Include="lcl\MouseAndKeyInput.pas"/>
+        <DCCReference Include="lcl\MouseInputIntf.pas"/>
+        <DCCReference Include="lcl\KeyInputIntf.pas"/>
+        <DCCReference Include="lcl\WinMouseInput.pas"/>
+        <DCCReference Include="lcl\WinKeyInput.pas"/>
+        <DCCReference Include="bcreg.pas"/>
+        <None Include="dtanalogcommon.pas"/>
+        <None Include="dtanaloggauge.pas"/>
+        <None Include="dtthemedgauge.pas"/>
+        <BuildConfiguration Include="Release">
+            <Key>Cfg_2</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Base">
+            <Key>Base</Key>
+        </BuildConfiguration>
+        <BuildConfiguration Include="Debug">
+            <Key>Cfg_1</Key>
+            <CfgParent>Base</CfgParent>
+        </BuildConfiguration>
+    </ItemGroup>
+    <ProjectExtensions>
+        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+        <Borland.ProjectType>Package</Borland.ProjectType>
+        <BorlandProject>
+            <Delphi.Personality>
+                <Source>
+                    <Source Name="MainSource">bgracontrols.dpk</Source>
+                </Source>
+                <VersionInfo>
+                    <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
+                    <VersionInfo Name="AutoIncBuild">False</VersionInfo>
+                    <VersionInfo Name="MajorVer">1</VersionInfo>
+                    <VersionInfo Name="MinorVer">0</VersionInfo>
+                    <VersionInfo Name="Release">0</VersionInfo>
+                    <VersionInfo Name="Build">0</VersionInfo>
+                    <VersionInfo Name="Debug">False</VersionInfo>
+                    <VersionInfo Name="PreRelease">False</VersionInfo>
+                    <VersionInfo Name="Special">False</VersionInfo>
+                    <VersionInfo Name="Private">False</VersionInfo>
+                    <VersionInfo Name="DLL">False</VersionInfo>
+                    <VersionInfo Name="Locale">1046</VersionInfo>
+                    <VersionInfo Name="CodePage">1252</VersionInfo>
+                </VersionInfo>
+                <VersionInfoKeys>
+                    <VersionInfoKeys Name="CompanyName"/>
+                    <VersionInfoKeys Name="FileDescription"/>
+                    <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+                    <VersionInfoKeys Name="InternalName"/>
+                    <VersionInfoKeys Name="LegalCopyright"/>
+                    <VersionInfoKeys Name="LegalTrademarks"/>
+                    <VersionInfoKeys Name="OriginalFilename"/>
+                    <VersionInfoKeys Name="ProductName"/>
+                    <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+                    <VersionInfoKeys Name="Comments"/>
+                </VersionInfoKeys>
+                <Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k160.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp160.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl160.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
+                </Excluded_Packages>
+            </Delphi.Personality>
+            <Deployment Version="3"/>
+            <Platforms>
+                <Platform value="Android">False</Platform>
+                <Platform value="iOSDevice32">False</Platform>
+                <Platform value="iOSSimulator">False</Platform>
+                <Platform value="OSX32">False</Platform>
+                <Platform value="Win32">True</Platform>
+                <Platform value="Win64">False</Platform>
+            </Platforms>
+        </BorlandProject>
+        <ProjectFileVersion>12</ProjectFileVersion>
+    </ProjectExtensions>
+    <Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
+    <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
+    <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
+</Project>

+ 2 - 0
bgracontrols.dproj.local

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<BorlandProject/>

+ 13 - 0
bgracontrols.inc

@@ -0,0 +1,13 @@
+{$IFDEF FPC}
+  {.$B-} // Boolean short-circuit evaluation ON
+  {$H+} // Long strings ON
+  {.$T-} // Type-checked pointers OFF
+  {.$X+} // Extended syntax ON
+
+  {$IFNDEF RO_FPC_MODE_SET}
+    {$MODE Delphi}
+  {$ENDIF}
+  {.$DEFINE INDEBUG}
+{$ELSE}
+  {.$DEFINE INDEBUG}
+{$ENDIF}

+ 86 - 80
bgracontrols.lpk

@@ -10,24 +10,30 @@
         <OtherUnitFiles Value="mouseandkeyinput"/>
         <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/$(FPCVer)"/>
       </SearchPaths>
+      <Parsing>
+        <SyntaxOptions>
+          <SyntaxMode Value="Delphi"/>
+          <CStyleOperator Value="False"/>
+          <AllowLabel Value="False"/>
+          <CPPInline Value="False"/>
+          <UseAnsiStrings Value="False"/>
+        </SyntaxOptions>
+      </Parsing>
       <CodeGeneration>
-        <SmartLinkUnit Value="True"/>
         <Optimizations>
-          <OptimizationLevel Value="3"/>
+          <OptimizationLevel Value="0"/>
           <VariablesInRegisters Value="True"/>
         </Optimizations>
       </CodeGeneration>
       <Linking>
         <Debugging>
-          <GenerateDebugInfo Value="False"/>
-          <DebugInfoType Value="dsDwarf2Set"/>
-          <UseValgrind Value="True"/>
+          <UseLineInfoUnit Value="False"/>
         </Debugging>
       </Linking>
     </CompilerOptions>
     <Description Value="BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications."/>
     <License Value="Modified LGPL"/>
-    <Version Major="5" Release="3"/>
+    <Version Major="5" Release="1"/>
     <Files Count="47">
       <Item1>
         <Filename Value="bcbasectrls.pas"/>
@@ -93,169 +99,169 @@
         <UnitName Value="BCMaterialDesignButton"/>
       </Item13>
       <Item14>
-        <Filename Value="bcmdbutton.pas"/>
-        <HasRegisterProc Value="True"/>
-        <UnitName Value="BCMDButton"/>
-      </Item14>
-      <Item15>
-        <Filename Value="bcmdbuttonfocus.pas"/>
-        <HasRegisterProc Value="True"/>
-        <UnitName Value="BCMDButtonFocus"/>
-      </Item15>
-      <Item16>
         <Filename Value="bcnumerickeyboard.pas"/>
         <AddToUsesPkgSection Value="False"/>
         <UnitName Value="BCNumericKeyboard"/>
-      </Item16>
-      <Item17>
+      </Item14>
+      <Item15>
         <Filename Value="bcpanel.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCPanel"/>
-      </Item17>
-      <Item18>
+      </Item15>
+      <Item16>
         <Filename Value="bcradialprogressbar.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCRadialProgressBar"/>
-      </Item18>
-      <Item19>
+      </Item16>
+      <Item17>
         <Filename Value="bcrtti.pas"/>
         <UnitName Value="BCRTTI"/>
-      </Item19>
-      <Item20>
+      </Item17>
+      <Item18>
         <Filename Value="bcsamples.pas"/>
         <UnitName Value="BCSamples"/>
-      </Item20>
-      <Item21>
+      </Item18>
+      <Item19>
         <Filename Value="bcstylesform.pas"/>
         <UnitName Value="BCStylesForm"/>
-      </Item21>
-      <Item22>
+      </Item19>
+      <Item20>
         <Filename Value="bcsvgbutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCSVGButton"/>
-      </Item22>
-      <Item23>
+      </Item20>
+      <Item21>
         <Filename Value="bcsvgviewer.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCSVGViewer"/>
-      </Item23>
-      <Item24>
+      </Item21>
+      <Item22>
         <Filename Value="bcthememanager.pas"/>
         <AddToUsesPkgSection Value="False"/>
         <UnitName Value="BCThemeManager"/>
-      </Item24>
-      <Item25>
+      </Item22>
+      <Item23>
         <Filename Value="bctoolbar.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCToolBar"/>
-      </Item25>
-      <Item26>
+      </Item23>
+      <Item24>
         <Filename Value="bctools.pas"/>
         <AddToUsesPkgSection Value="False"/>
         <UnitName Value="BCTools"/>
-      </Item26>
-      <Item27>
+      </Item24>
+      <Item25>
         <Filename Value="bctrackbarupdown.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BCTrackbarUpdown"/>
-      </Item27>
-      <Item28>
+      </Item25>
+      <Item26>
         <Filename Value="bctypes.pas"/>
         <AddToUsesPkgSection Value="False"/>
         <UnitName Value="BCTypes"/>
-      </Item28>
-      <Item29>
+      </Item26>
+      <Item27>
         <Filename Value="bgracustomdrawn.pas"/>
         <UnitName Value="BGRACustomDrawn"/>
-      </Item29>
-      <Item30>
+      </Item27>
+      <Item28>
         <Filename Value="bgraflashprogressbar.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAFlashProgressBar"/>
-      </Item30>
-      <Item31>
+      </Item28>
+      <Item29>
         <Filename Value="bgragraphiccontrol.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAGraphicControl"/>
-      </Item31>
-      <Item32>
+      </Item29>
+      <Item30>
         <Filename Value="bgraimagelist.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAImageList"/>
-      </Item32>
-      <Item33>
+      </Item30>
+      <Item31>
         <Filename Value="bgraimagemanipulation.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAImageManipulation"/>
-      </Item33>
-      <Item34>
+      </Item31>
+      <Item32>
         <Filename Value="bgraknob.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAKnob"/>
-      </Item34>
-      <Item35>
+      </Item32>
+      <Item33>
         <Filename Value="bgraresizespeedbutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAResizeSpeedButton"/>
-      </Item35>
-      <Item36>
+      </Item33>
+      <Item34>
         <Filename Value="bgrashape.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAShape"/>
-      </Item36>
-      <Item37>
+      </Item34>
+      <Item35>
         <Filename Value="bgraspeedbutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRASpeedButton"/>
-      </Item37>
-      <Item38>
+      </Item35>
+      <Item36>
         <Filename Value="bgraspriteanimation.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRASpriteAnimation"/>
-      </Item38>
-      <Item39>
+      </Item36>
+      <Item37>
         <Filename Value="bgravirtualscreen.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="BGRAVirtualScreen"/>
-      </Item39>
-      <Item40>
+      </Item37>
+      <Item38>
         <Filename Value="colorspeedbutton.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="ColorSpeedButton"/>
-      </Item40>
-      <Item41>
+      </Item38>
+      <Item39>
         <Filename Value="dtanalogclock.pas"/>
         <HasRegisterProc Value="True"/>
         <UnitName Value="DTAnalogClock"/>
+      </Item39>
+      <Item40>
+        <Filename Value="dtthemedclock.pas"/>
+        <HasRegisterProc Value="True"/>
+        <UnitName Value="dtthemedclock"/>
+      </Item40>
+      <Item41>
+        <Filename Value="materialcolors.pas"/>
+        <UnitName Value="MaterialColors"/>
       </Item41>
       <Item42>
-        <Filename Value="dtanalogcommon.pp"/>
+        <Filename Value="mouseandkeyinput/mouseandkeyinput.pas"/>
         <AddToUsesPkgSection Value="False"/>
-        <UnitName Value="DTAnalogCommon"/>
+        <UnitName Value="MouseAndKeyInput"/>
       </Item42>
       <Item43>
-        <Filename Value="dtanaloggauge.pp"/>
+        <Filename Value="bcmdbutton.pas"/>
         <HasRegisterProc Value="True"/>
-        <UnitName Value="DTAnalogGauge"/>
+        <UnitName Value="BCMDButton"/>
       </Item43>
       <Item44>
-        <Filename Value="dtthemedclock.pas"/>
+        <Filename Value="bcmdbuttonfocus.pas"/>
         <HasRegisterProc Value="True"/>
-        <UnitName Value="dtthemedclock"/>
+        <UnitName Value="BCMDButtonFocus"/>
       </Item44>
       <Item45>
-        <Filename Value="dtthemedgauge.pp"/>
-        <HasRegisterProc Value="True"/>
-        <UnitName Value="dtthemedgauge"/>
+        <Filename Value="dtanalogcommon.pas"/>
+        <UnitName Value="DTAnalogCommon"/>
       </Item45>
       <Item46>
-        <Filename Value="materialcolors.pas"/>
-        <UnitName Value="MaterialColors"/>
+        <Filename Value="dtanaloggauge.pas"/>
+        <HasRegisterProc Value="True"/>
+        <AddToUsesPkgSection Value="False"/>
+        <UnitName Value="DTAnalogGauge"/>
       </Item46>
       <Item47>
-        <Filename Value="mouseandkeyinput/mouseandkeyinput.pas"/>
-        <AddToUsesPkgSection Value="False"/>
-        <UnitName Value="MouseAndKeyInput"/>
+        <Filename Value="dtthemedgauge.pas"/>
+        <HasRegisterProc Value="True"/>
+        <UnitName Value="dtthemedgauge"/>
       </Item47>
     </Files>
     <RequiredPkgs Count="2">

+ 12 - 12
bgracontrols.pas

@@ -8,15 +8,15 @@ unit bgracontrols;
 interface
 
 uses
-  BCButton, BCButtonFocus, BCEffect, bcfilters, BCGameGrid, BCImageButton, 
-  BCLabel, BCListBox, BCMaterialDesignButton, BCMDButton, BCMDButtonFocus, 
-  BCPanel, BCRadialProgressBar, BCRTTI, BCSamples, BCStylesForm, BCSVGButton, 
-  BCSVGViewer, BCToolBar, BCTrackbarUpdown, BGRACustomDrawn, 
-  BGRAFlashProgressBar, BGRAGraphicControl, BGRAImageList, 
-  BGRAImageManipulation, BGRAKnob, BGRAResizeSpeedButton, BGRAShape, 
-  BGRASpeedButton, BGRASpriteAnimation, BGRAVirtualScreen, ColorSpeedButton, 
-  DTAnalogClock, DTAnalogGauge, dtthemedclock, dtthemedgauge, MaterialColors, 
-  LazarusPackageIntf;
+ BCButton, BCButtonFocus, BCEffect, bcfilters, BCGameGrid, BCImageButton, 
+ BCLabel, BCListBox, BCMaterialDesignButton, BCPanel, BCRadialProgressBar, 
+ BCRTTI, BCSamples, BCStylesForm, BCSVGButton, BCSVGViewer, BCToolBar, 
+ BCTrackbarUpdown, BGRACustomDrawn, BGRAFlashProgressBar, BGRAGraphicControl, 
+ BGRAImageList, BGRAImageManipulation, BGRAKnob, BGRAResizeSpeedButton, 
+ BGRAShape, BGRASpeedButton, BGRASpriteAnimation, BGRAVirtualScreen, 
+ ColorSpeedButton, DTAnalogClock, dtthemedclock, MaterialColors, BCMDButton, 
+ BCMDButtonFocus, DTAnalogCommon, DTAnalogGauge, dtthemedgauge, 
+ LazarusPackageIntf;
 
 implementation
 
@@ -29,8 +29,6 @@ begin
   RegisterUnit('BCLabel', @BCLabel.Register);
   RegisterUnit('BCListBox', @BCListBox.Register);
   RegisterUnit('BCMaterialDesignButton', @BCMaterialDesignButton.Register);
-  RegisterUnit('BCMDButton', @BCMDButton.Register);
-  RegisterUnit('BCMDButtonFocus', @BCMDButtonFocus.Register);
   RegisterUnit('BCPanel', @BCPanel.Register);
   RegisterUnit('BCRadialProgressBar', @BCRadialProgressBar.Register);
   RegisterUnit('BCSVGButton', @BCSVGButton.Register);
@@ -49,8 +47,10 @@ begin
   RegisterUnit('BGRAVirtualScreen', @BGRAVirtualScreen.Register);
   RegisterUnit('ColorSpeedButton', @ColorSpeedButton.Register);
   RegisterUnit('DTAnalogClock', @DTAnalogClock.Register);
-  RegisterUnit('DTAnalogGauge', @DTAnalogGauge.Register);
   RegisterUnit('dtthemedclock', @dtthemedclock.Register);
+  RegisterUnit('BCMDButton', @BCMDButton.Register);
+  RegisterUnit('BCMDButtonFocus', @BCMDButtonFocus.Register);
+  RegisterUnit('DTAnalogGauge', @DTAnalogGauge.Register);
   RegisterUnit('dtthemedgauge', @dtthemedgauge.Register);
 end;
 

+ 10 - 0
bgracontrols.stat

@@ -0,0 +1,10 @@
+[Stats]
+EditorSecs=1
+DesignerSecs=1
+InspectorSecs=16
+CompileSecs=20315
+OtherSecs=336
+StartTime=30/11/2018 11:43:57
+RealKeys=0
+EffectiveKeys=0
+DebugSecs=1

+ 10 - 3
bgracustomdrawn.pas

@@ -1,11 +1,17 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRACustomDrawn;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
   Classes, Types, FPCanvas, Graphics, Controls, Math, LazUTF8, Forms, ExtCtrls,
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
   BCThemeManager,
   { CustomDrawn }
   CustomDrawnControls, CustomDrawnDrawers, CustomDrawn_Common,
@@ -212,16 +218,17 @@ type
       AState: TCDControlState; AStateEx: TCDControlStateEx); override;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-procedure Register;
+{$IFDEF FPC}procedure Register;
 begin
   RegisterComponents('BGRA Custom Drawn', [TBCDButton, TBCDEdit,
     TBCDStaticText, TBCDProgressBar, TBCDSpinEdit, TBCDCheckBox,
     TBCDRadioButton, TBCDPanel]);
 end;
+{$ENDIF}
 
 { TBCDRadioButton }
 

+ 24 - 10
bgraflashprogressbar.pas

@@ -33,15 +33,21 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAFlashProgressBar;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, LMessages, Forms, Controls, Graphics,
-  Dialogs, BGRABitmap, Math;
+  Classes, SysUtils, {$IFDEF FPC}LResources, LMessages,{$ENDIF} Types, Forms, Controls, Graphics,
+  {$IFNDEF FPC}Messages, Windows, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, Dialogs, BGRABitmap, Math;
 
 type
 
@@ -49,7 +55,7 @@ type
 
   { TBGRAFlashProgressBar }
 
-  TBGRAFlashProgressBar = class(TGraphicControl)
+  TBGRAFlashProgressBar = class(TBGRAGraphicCtrl)
   private
     FBackgroundRandomize: boolean;
     FBackgroundRandomizeMaxIntensity: word;
@@ -74,15 +80,17 @@ type
     procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
       WithThemeSpace: boolean); override;
     procedure Paint; override;
-    procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
+    procedure WMEraseBkgnd(var Message: {$IFDEF FPC}TLMEraseBkgnd{$ELSE}TWMEraseBkgnd{$ENDIF}); message {$IFDEF FPC}LM_ERASEBKGND{$ELSE}WM_ERASEBKGND{$ENDIF};
   public
     { Public declarations }
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
   public
     { Streaming }
+    {$IFDEF FPC}
     procedure SaveToFile(AFileName: string);
     procedure LoadFromFile(AFileName: string);
+    {$ENDIF}
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
   published
@@ -109,17 +117,19 @@ type
     property BackgroundRandomize: boolean read FBackgroundRandomize write SetFBackgroundRandomize;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses BGRABitmapTypes, BGRAGradients, Types;
+uses BGRABitmapTypes, BGRAGradients;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgraflashprogressbar_icon.lrs}
   RegisterComponents('BGRA Controls', [TBGRAFlashProgressBar]);
 end;
+{$ENDIF}
 
 { TBGRAFlashProgressBar }
 
@@ -161,6 +171,7 @@ procedure TBGRAFlashProgressBar.Paint;
 var
   content: TRect;
   xpos, y, tx, ty: integer;
+  grayValue: integer;
   bgColor: TBGRAPixel;
 
   function ApplyLightness(c: TBGRAPixel; lightness: word): TBGRAPixel;
@@ -237,7 +248,7 @@ begin
 end;
 
 {$hints off}
-procedure TBGRAFlashProgressBar.WMEraseBkgnd(var Message: TLMEraseBkgnd);
+procedure TBGRAFlashProgressBar.WMEraseBkgnd(var Message: {$IFDEF FPC}TLMEraseBkgnd{$ELSE}TWMEraseBkgnd{$ENDIF});
 begin
   //do nothing
 end;
@@ -247,8 +258,10 @@ end;
 constructor TBGRAFlashProgressBar.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, CX, 33);
+
   FMinValue := 0;
   FMaxValue := 100;
   FValue := 30;
@@ -267,7 +280,7 @@ begin
   FreeAndNil(FBmp);
   inherited Destroy;
 end;
-
+{$IFDEF FPC}
 procedure TBGRAFlashProgressBar.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -288,11 +301,12 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
 end;
+{$ENDIF}
 
 procedure TBGRAFlashProgressBar.OnFindClass(Reader: TReader;
   const AClassName: string; var ComponentClass: TComponentClass);

+ 23 - 6
bgragraphiccontrol.pas

@@ -33,21 +33,27 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAGraphicControl;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  ExtCtrls, BGRABitmap, BCTypes;
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF} Forms, Controls, Graphics, Dialogs, Types,
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, ExtCtrls, BGRABitmap, BCTypes;
 
 type
 
   { TCustomBGRAGraphicControl }
 
-  TCustomBGRAGraphicControl = class(TGraphicControl)
+  TCustomBGRAGraphicControl = class(TBGRAGraphicCtrl)
   private
     { Private declarations }
     FOnRedraw:     TBGRARedrawEvent;
@@ -110,21 +116,25 @@ type
     property OnMouseLeave;
     property OnMouseMove;
     property OnMouseUp;
+    {$IFDEF FPC}
     property OnPaint;
+    {$ENDIF}
     property Caption;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses BGRABitmapTypes, Types;
+uses BGRABitmapTypes;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgragraphiccontrol_icon.lrs}
   RegisterComponents('BGRA Controls', [TBGRAGraphicControl]);
 end;
+{$ENDIF}
 
 procedure TCustomBGRAGraphicControl.SetAlignment(const Value: TAlignment);
 begin
@@ -222,12 +232,16 @@ begin
     if Caption <> '' then
     begin
       FBGRA.CanvasBGRA.Font.Assign(Canvas.Font);
+      {$IFDEF FPC}//#
       TS := Canvas.TextStyle;
+      {$ENDIF}
       TS.Alignment := Alignment;
       TS.Layout := tlCenter;
       TS.Opaque := False;
       TS.Clipping := False;
+      {$IFDEF FPC}//#
       TS.SystemFont := Canvas.Font.IsDefault;
+      {$ENDIF}
 
       FBGRA.CanvasBGRA.Font.Color := Color xor $FFFFFF;
       FBGRA.CanvasBGRA.Font.Opacity := 255;
@@ -249,6 +263,7 @@ procedure TCustomBGRAGraphicControl.SetColor(Value: TColor);
 begin
   if Value <> Color then
     DiscardBitmap;
+
   inherited SetColor(Value);
 end;
 
@@ -267,8 +282,10 @@ end;
 constructor TCustomBGRAGraphicControl.Create(TheOwner: TComponent);
 begin
   inherited Create(TheOwner);
+
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, CX, CY);
+
   FBGRA := TBGRABitmap.Create;
   FBevelWidth := 1;
   FAlignment := taCenter;

+ 18 - 3
bgraimagelist.pas

@@ -28,14 +28,19 @@
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAImageList;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF} Forms, Controls, Graphics, Dialogs,
   GraphType, BGRABitmap, BGRABitmapTypes, {%H-}ImgList;
 
 {$IFDEF LCLgtk}
@@ -73,15 +78,17 @@ type
     { Published declarations }
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgraimagelist_icon.lrs}
   RegisterComponents('BGRA Controls', [TBGRAImageList]);
 end;
+{$ENDIF}
 
 {$IFDEF BGRA_DRAW}
 { TBGRAImageList }
@@ -115,13 +122,21 @@ begin
   case ADrawEffect of
     gdeDisabled:
     begin
+      {$IFDEF FPC}
       GetBitmap(AIndex, FBmp, gdeNormal);
+      {$ELSE}
+      GetBitmapRaw(AIndex, FBmp, gdeNormal);
+      {$ENDIF}
       FBGRA.Assign(FBmp);
       BGRAReplace(FBGRA, FBGRA.FilterGrayscale);
     end;
     else
     begin
+      {$IFDEF FPC}
       GetBitmap(AIndex, FBmp, ADrawEffect);
+      {$ELSE}
+      GetBitmapRaw(AIndex, FBmp, ADrawEffect);
+      {$ENDIF}
       FBGRA.Assign(FBmp);
     end;
   end;

+ 36 - 6
bgraimagemanipulation.pas

@@ -70,13 +70,39 @@ unit BGRAImageManipulation;
   ============================================================================
 }
 
-{$mode objfpc}{$H+}
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, Contnrs, SysUtils, LResources, Forms, Controls, BGRABitmap, BGRABitmapTypes,
-  Graphics, Dialogs, LCLIntf, BGRAGradientScanner;
+  Classes, Contnrs, SysUtils, {$IFDEF FPC}LCLIntf, LResources,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}Windows, Messages, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, BGRAGradientScanner;
+
+  {$IFNDEF FPC}
+const
+  crSizeNW      = TCursor(-23);
+  crSizeN       = TCursor(-24);
+  crSizeNE      = TCursor(-25);
+  crSizeW       = TCursor(-26);
+  crSizeE       = TCursor(-27);
+  crSizeSW      = TCursor(-28);
+  crSizeS       = TCursor(-29);
+  crSizeSE      = TCursor(-30);
+  crUpArrow     = TCursor(-10);
+  crHourGlass   = TCursor(-11);
+  crDrag        = TCursor(-12);
+  crNoDrop      = TCursor(-13);
+  crHSplit      = TCursor(-14);
+  crVSplit      = TCursor(-15);
+  crMultiDrag   = TCursor(-16);
+  {$ENDIF}
 
 type
   TCoord = packed record
@@ -140,7 +166,7 @@ type
 
   { TBGRAImageManipulation }
 
-  TBGRAImageManipulation = class(TGraphicControl)
+  TBGRAImageManipulation = class(TBGRAGraphicCtrl)
   private
     { Private declarations }
 
@@ -241,7 +267,7 @@ type
     property Empty: boolean Read getEmpty;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -1085,7 +1111,7 @@ begin
           rCropArea :=rCropAreas[i];
           rCropRectI :=rCropArea.Area;
           InflateRect(rCropRectI, AnchorSize, AnchorSize);
-          if (PtInRect(rCropRectI, APoint)) then
+          if ({$IFNDEF FPC}BGRAGraphics.{$ENDIF}PtInRect(rCropRectI, APoint)) then
           begin
                rCropRect :=rCropArea.Area;
                // Verifies that is positioned on an anchor
@@ -2658,10 +2684,14 @@ end;
  { =====[ Register Function ]================================================== }
  { ============================================================================ }
 
+{$IFDEF FPC}
 procedure Register;
 begin
+  {$IFDEF FPC}
   {$I icons\BGRAImageManipulation_icon.lrs}
+  {$ENDIF}
   RegisterComponents('BGRA Controls', [TBGRAImageManipulation]);
 end;
+{$ENDIF}
 
 end.

+ 28 - 16
bgraknob.pas

@@ -32,16 +32,22 @@
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 
 unit BGRAKnob;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BGRAGradients, BGRABitmap, BGRABitmapTypes;
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF} Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRAGradients, BGRABitmap, BGRABitmapTypes;
 
 type
   TBGRAKnobPositionType = (kptLineSquareCap, kptLineRoundCap, kptFilledCircle,
@@ -50,7 +56,7 @@ type
 
   { TBGRAKnob }
 
-  TBGRAKnob = class(TGraphicControl)
+  TBGRAKnob = class(TBGRAGraphicCtrl)
   private
     { Private declarations }
     FPhong: TPhongShading;
@@ -93,16 +99,18 @@ type
     procedure MouseMove(Shift: TShiftState; X, Y: integer); override;
     procedure Paint; override;
     procedure Resize; override;
-    function ValueCorrection(var AValue: single): boolean; virtual; overload;
-    function ValueCorrection: boolean; virtual; overload;
+    function ValueCorrection(var AValue: single): boolean; overload; virtual;
+    function ValueCorrection: boolean; overload; virtual;
   public
     { Public declarations }
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
   public
     { Streaming }
+    {$IFDEF FPC}
     procedure SaveToFile(AFileName: string);
     procedure LoadFromFile(AFileName: string);
+    {$ENDIF}
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
   published
@@ -126,18 +134,19 @@ type
     property StartFromBottom: boolean read FStartFromBottom write SetStartFromBottom;
   end;
 
-
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
 uses Math;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgraknob_icon.lrs}
   RegisterComponents('BGRA Controls', [TBGRAKnob]);
 end;
+{$ENDIF}
 
 { TBGRAKnob }
 
@@ -178,8 +187,8 @@ begin
         //compute vector between center and current pixel
         v := PointF(xb, yb) - center;
         //scale down to unit circle (with 1 pixel margin for soft border)
-        v.x /= tx / 2 + 1;
-        v.y /= ty / 2 + 1;
+        v.x := v.x /(tx / 2 + 1);
+        v.y := v.y / (ty / 2 + 1);
         //compute squared distance with scalar product
         d2 := v * v;
         //interpolate as quadratic curve and apply power function
@@ -216,10 +225,10 @@ function TBGRAKnob.GetValue: single;
 begin
   Result := FAngularPos * 180 / Pi;
   if Result < 0 then
-    Result += 360;
+    Result := Result +360;
   Result := 270 - Result;
   if Result < 0 then
-    Result += 360;
+    Result := Result +360;
 end;
 
 procedure TBGRAKnob.SetCurveExponent(const AValue: single);
@@ -265,9 +274,9 @@ begin
   ValueCorrection(AValue);
   NewAngularPos := 3 * Pi / 2 - AValue * Pi / 180;
   if NewAngularPos > Pi then
-    NewAngularPos -= 2 * Pi;
+    NewAngularPos := NewAngularPos -(2 * Pi);
   if NewAngularPos < -Pi then
-    NewAngularPos += 2 * Pi;
+    NewAngularPos := NewAngularPos +(2 * Pi);
   if NewAngularPos <> FAngularPos then
   begin
     FAngularPos := NewAngularPos;
@@ -489,8 +498,10 @@ end;
 constructor TBGRAKnob.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, CX, CY);
+
   FPhong := TPhongShading.Create;
   FPhong.LightPositionZ := 100;
   FPhong.LightSourceIntensity := 300;
@@ -518,7 +529,7 @@ begin
   FKnobBmp.Free;
   inherited Destroy;
 end;
-
+{$IFDEF FPC}
 procedure TBGRAKnob.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -539,11 +550,12 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
 end;
+{$ENDIF}
 
 procedure TBGRAKnob.OnFindClass(Reader: TReader; const AClassName: string;
   var ComponentClass: TComponentClass);

+ 6 - 1
bgrapascalscript.pas

@@ -33,9 +33,14 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAPascalScript;
 // Note: overloaded procedures not supported, use unique identifiers
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 

+ 6 - 1
bgrapascalscriptcomponent.pas

@@ -2,6 +2,11 @@
   This source is only used to compile and install the package.
  }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit bgrapascalscriptcomponent;
 
 interface
@@ -11,7 +16,7 @@ uses
 
 implementation
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 begin
   RegisterUnit('uPSI_BGRAPascalScript', @uPSI_BGRAPascalScript.Register);
 end;

+ 15 - 6
bgraresizespeedbutton.pas

@@ -32,15 +32,22 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAResizeSpeedButton;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, Buttons, LResources, Forms,
-  Controls, Graphics, Dialogs, BGRASpeedButton, BGRABitmap;
+  Classes, SysUtils, Buttons, {$IFDEF FPC}LResources,{$ENDIF} Forms,
+  Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BGRASpeedButton, BGRABitmap;
 
 type
   TBGRAResizeSpeedButton = class(TBGRASpeedButton)
@@ -51,7 +58,7 @@ type
     { Protected declarations }
     function DrawGlyph(ACanvas: TCanvas; const AClient: TRect;
       const {%H-}AOffset: TPoint; AState: TButtonState; {%H-}ATransparent: boolean;
-      {%H-}BiDiFlags: longint): TRect; override;
+      {%H-}BiDiFlags: longint): TRect; {$IFDEF FPC}override;{$ENDIF}
   public
     { Public declarations }
     constructor Create(AOwner: TComponent); override;
@@ -60,7 +67,7 @@ type
     { Published declarations }
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -96,10 +103,12 @@ begin
   inherited Destroy;
 end;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgraresizespeedbutton_icon.lrs}
-  RegisterComponents('BGRA Button Controls', [TBGRAResizeSpeedButton]);
+  RegisterComponents('BGRA Controls', [TBGRAResizeSpeedButton]);
 end;
+{$ENDIF}
 
 end.

+ 7 - 7
bgrascript.pas

@@ -35,7 +35,7 @@
 
 unit BGRAScript;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 { $define debug}
 
 interface
@@ -133,7 +133,7 @@ function ScriptCommand(command: string; var bitmap: TBGRABitmap;
     if passed <> mustbe then
       Result := False;
 
-  {$ifdef debug}
+  {$IFDEF INDEBUG}
     if not Result then
     begin
       writeln('>> Wrong number of parameters: ' + IntToStr(passed));
@@ -148,7 +148,7 @@ function ScriptCommand(command: string; var bitmap: TBGRABitmap;
     if passed < mustbe then
       Result := False;
 
-  {$ifdef debug}
+  {$IFDEF INDEBUG}
     if not Result then
     begin
       writeln('>> Wrong number of parameters: ' + IntToStr(passed));
@@ -642,14 +642,14 @@ begin
 
     else
     begin
-      {$ifdef debug}
+      {$IFDEF INDEBUG}
       writeln('>> Command "' + list[0] + '" not found.');
       {$endif}
       Result := False;
     end;
   end;
 
-  {$ifdef debug}
+  {$IFDEF INDEBUG}
   if not Result then
     writeln('>> ERROR');
   for i := 0 to list.Count - 1 do
@@ -665,7 +665,7 @@ var
   line: integer;
   variables: TStringList;
 begin
-  {$ifdef debug}
+  {$IFDEF INDEBUG}
   //writeln('----SCRIPT--LIST----');
   writeln(' Executing ' + IntToStr(commandlist.Count) + ' lines...');
   writeln('____________________');
@@ -688,7 +688,7 @@ begin
 
   variables.Free;
 
-  {$ifdef debug}
+  {$IFDEF INDEBUG}
   //writeln('----SCRIPT--LIST----');
   writeln(' END');
   writeln('____________________');

+ 27 - 10
bgrashape.pas

@@ -33,22 +33,28 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAShape;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BGRABitmap, BGRABitmapTypes, BCTypes;
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF} Forms, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, BCTypes;
 
 type
   TBGRAShapeType = (stRegularPolygon, stEllipse);
 
   { TBGRAShape }
 
-  TBGRAShape = class(TGraphicControl)
+  TBGRAShape = class(TBGRAGraphicCtrl)
   private
     { Private declarations }
     FBorderColor: TColor;
@@ -94,8 +100,10 @@ type
     destructor Destroy; override;
   public
     { Streaming }
+    {$IFDEF FPC}
     procedure SaveToFile(AFileName: string);
     procedure LoadFromFile(AFileName: string);
+    {$ENDIF}
     procedure OnFindClass({%H-}Reader: TReader; const AClassName: string;
       var ComponentClass: TComponentClass);
   published
@@ -103,7 +111,7 @@ type
     property AutoSize;
     property Align;
     property Anchors;
-    property Angle: single Read FAngle Write SetAngle default 0;
+    property Angle: single Read FAngle Write SetAngle {$IFDEF FPC}default 0{$ENDIF};
     property BorderWidth: integer Read FBorderWidth Write SetBorderWidth default 1;
     property BorderOpacity: byte Read FBorderOpacity Write SetBorderOpacity default 255;
     property BorderColor: TColor Read FBorderColor Write SetBorderColor;
@@ -114,7 +122,7 @@ type
     property FillOpacity: byte Read FFillOpacity Write SetFillOpacity;
     property FillGradient: TBCGradient Read FFillGradient Write SetFillGradient;
     property SideCount: integer Read FSideCount Write SetSideCount default 4;
-    property RatioXY: single Read FRatioXY Write SetRatioXY default 1;
+    property RatioXY: single Read FRatioXY Write SetRatioXY {$IFDEF FPC}default 1{$ENDIF};
     property UseRatioXY: boolean Read FUseRatioXY Write SetUseRatioXY default False;
     property UseFillGradient: boolean Read FUseFillGradient
       Write SetUseFillGradient default False;
@@ -137,17 +145,19 @@ type
     property OnMouseUp;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
 uses BCTools;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgrashape_icon.lrs}
   RegisterComponents('BGRA Controls', [TBGRAShape]);
 end;
+{$ENDIF}
 
 { TBGRAShape }
 
@@ -293,6 +303,11 @@ var
   i: integer;
   borderGrad, fillGrad: TBGRACustomScanner;
 begin
+  {$IFNDEF FPC}//# //@
+  if FBGRA <> nil then
+    FBGRA.SetSize(Width, Height);
+  {$ENDIF}
+
   FBGRA.FillTransparent;
   FBGRA.PenStyle := FBorderStyle;
   with FBGRA.Canvas2D do
@@ -401,8 +416,10 @@ end;
 constructor TBGRAShape.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, CX, CY);
+
   FBGRA := TBGRABitmap.Create(Width, Height, BGRAPixelTransparent);
 
   FBorderColor := clWindowText;
@@ -431,7 +448,7 @@ begin
   FBorderGradient.Free;
   inherited Destroy;
 end;
-
+{$IFDEF FPC}
 procedure TBGRAShape.SaveToFile(AFileName: string);
 var
   AStream: TMemoryStream;
@@ -452,12 +469,12 @@ begin
   AStream := TMemoryStream.Create;
   try
     AStream.LoadFromFile(AFileName);
-    ReadComponentFromTextStream(AStream, TComponent(Self), @OnFindClass);
+    ReadComponentFromTextStream(AStream, TComponent(Self), OnFindClass);
   finally
     AStream.Free;
   end;
 end;
-
+{$ENDIF}
 procedure TBGRAShape.OnFindClass(Reader: TReader; const AClassName: string;
   var ComponentClass: TComponentClass);
 begin

+ 22 - 16
bgraspeedbutton.pas

@@ -28,14 +28,20 @@
   along with this library; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRASpeedButton;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons, BGRABitmap,
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF} Forms, Controls, Graphics, Dialogs, Buttons, BGRABitmap,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
   BGRABitmapTypes;
 
 {$IFDEF LCLgtk}
@@ -60,8 +66,8 @@ type
     { Protected declarations }
     {$IFDEF BGRA_DRAW}
     function DrawGlyph(ACanvas: TCanvas; const AClient: TRect;
-      const AOffset: TPoint; AState: TButtonState; {%H-}ATransparent: boolean;
-      {%H-}BiDiFlags: longint): TRect; override;
+      const AOffset: TPoint; AState: TButtonState; ATransparent: boolean;
+      BiDiFlags: longint): TRect; override;
     {$ENDIF}
   public
     { Public declarations }
@@ -73,15 +79,17 @@ type
     { Published declarations }
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgraspeedbutton_icon.lrs}
-  RegisterComponents('BGRA Button Controls', [TBGRASpeedButton]);
+  RegisterComponents('BGRA Controls', [TBGRASpeedButton]);
 end;
+{$ENDIF}
 
 {$IFDEF BGRA_DRAW}
 { TBGRASpeedButton }
@@ -94,21 +102,19 @@ begin
   {Result := inherited DrawGlyph(ACanvas, AClient, AOffset, AState,
     ATransparent, BiDiFlags); }
 
-  if not Assigned(Glyph) then
-  begin
-    Result := Rect(0,0,0,0);
+  if Glyph = nil then
     Exit;
-  end;
-
   { It's not good solution assigning glyph on each draw call but FGlyph and SetGlyph is
     in private section }
   FBGRA.Assign(Glyph);
 
-  if (AState = bsDown) or (Down = True) then
-    FBGRA.Draw(ACanvas, AOffset.x + 1, AOffset.y + 1, False)
-  else
-    FBGRA.Draw(ACanvas, AOffset.x, AOffset.y, False);
-  Result:= AClient;
+  if Assigned(Glyph) then
+  begin
+    if (AState = bsDown) or (Down = True) then
+      FBGRA.Draw(ACanvas, AOffset.x + 1, AOffset.y + 1, False)
+    else
+      FBGRA.Draw(ACanvas, AOffset.x, AOffset.y, False);
+  end;
 end;
 
 constructor TBGRASpeedButton.Create(AOwner: TComponent);

+ 21 - 17
bgraspriteanimation.pas

@@ -33,15 +33,21 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRASpriteAnimation;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, Controls, Dialogs, ExtCtrls, Forms, Graphics, LCLIntF, LResources,
-  BGRABitmap, BGRABitmapTypes, BCTypes, BGRAAnimatedGif;
+  Classes, Controls, Dialogs, ExtCtrls, Forms, {$IFDEF FPC}LCLIntF, LResources,{$ENDIF} Graphics,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, BCTypes, BGRAAnimatedGif;
 
 type
 
@@ -50,7 +56,7 @@ type
 
   { TBGRASpriteAnimation }
 
-  TBGRASpriteAnimation = class(TGraphicControl)
+  TBGRASpriteAnimation = class(TBGRAGraphicCtrl)
   private
     { Private declarations }
     FAnimInvert: boolean;
@@ -113,8 +119,7 @@ type
   public
     { Public declarations }
     procedure GifImageToSprite(Gif: TBGRAAnimatedGif);//FreeMan35 added
-    procedure LoadFromResourceName(Instance: THandle; const ResName: string); overload;
-    procedure LoadFromBitmapResource(const Resource: string); overload;
+    procedure LoadFromResourceName(Instance: THandle; const ResName: string);
     //FreeMan35 added
     procedure AnimatedGifToSprite(Filename: string);
     constructor Create(AOwner: TComponent); override;
@@ -166,15 +171,17 @@ type
     property Visible;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgraspriteanimation_icon.lrs}
   RegisterComponents('BGRA Controls', [TBGRASpriteAnimation]);
 end;
+{$ENDIF}
 
 { TBGRASpriteAnimation }
 
@@ -486,7 +493,7 @@ procedure TBGRASpriteAnimation.Paint;
     with inherited Canvas do
     begin
       Pen.Color := clBlack;
-      Pen.Style := psDash;
+      Pen.Style := graphics.psDash;
       MoveTo(0, 0);
       LineTo(Self.Width - 1, 0);
       LineTo(Self.Width - 1, Self.Height - 1);
@@ -542,7 +549,7 @@ begin
   FSprite.Width := Gif.Width * Gif.Count;
   FSprite.Height := Gif.Height;
   FSprite.Canvas.Brush.Color := SpriteKeyColor;
-  FSprite.Canvas.FillRect(0, 0, FSprite.Width, FSprite.Height);
+  FSprite.Canvas.FillRect(Rect(0, 0, FSprite.Width, FSprite.Height));
   FSprite.Canvas.Draw(0, 0, TempBitmap.Bitmap);
   TempBitmap.Free;
 end;
@@ -553,18 +560,14 @@ var
   TempGif: TBGRAAnimatedGif;
 begin
   TempGif := TBGRAAnimatedGif.Create;
+  {$IFDEF FPC}//#
   TempGif.LoadFromResourceName(Instance, ResName);
-
+  {$ENDIF}
   GifImageToSprite(TempGif);
 
   TempGif.Free;
 end;
 
-procedure TBGRASpriteAnimation.LoadFromBitmapResource(const Resource: string);
-begin
-  LoadFromResourceName(HInstance, Resource);
-end;
-
 procedure TBGRASpriteAnimation.AnimatedGifToSprite(Filename: string);
 var
   TempGif: TBGRAAnimatedGif;
@@ -627,8 +630,10 @@ end;
 constructor TBGRASpriteAnimation.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, CX, CY);
+
   FAnimInvert := False;
   FAnimPosition := 1;
   FAnimRepeat := 0;
@@ -637,7 +642,7 @@ begin
   FAnimStatic := False;
   FAnimTimer := TTimer.Create(Self);
   FAnimTimer.Interval := FAnimSpeed;
-  FAnimTimer.OnTimer := @DoAnimTimerOnTimer;
+  FAnimTimer.OnTimer := DoAnimTimerOnTimer;
   FAutoSize := False;
   FCenter := True;
   FProportional := True;
@@ -658,7 +663,6 @@ end;
 
 destructor TBGRASpriteAnimation.Destroy;
 begin
-  FAnimTimer.Enabled := False;
   FAnimTimer.OnTimer := nil;
   FAnimTimer.Free;
   FSprite.Free;

+ 28 - 12
bgravirtualscreen.pas

@@ -33,20 +33,26 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit BGRAVirtualScreen;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  ExtCtrls, LMessages, BGRABitmap, BCTypes;
+  Classes, SysUtils, {$IFDEF FPC}LMessages, LResources, LCLIntf,{$ENDIF}  Types, Forms, BCBaseCtrls, Controls, Graphics, Dialogs,
+  {$IFNDEF FPC}Windows, Messages, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  ExtCtrls, BGRABitmap, BCTypes;
 
 type
   { TCustomBGRAVirtualScreen }
 
-  TCustomBGRAVirtualScreen = class(TCustomPanel)
+  TCustomBGRAVirtualScreen = class(TBGRACustomPanel)
   private
     { Private declarations }
     FBGRA:        TBGRABitmap;
@@ -68,8 +74,8 @@ type
     procedure Resize; override;
     procedure BGRASetSize(AWidth, AHeight: integer);
     procedure RedrawBitmapContent; virtual;
-    procedure SetColor(Value: TColor); override;
-    procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
+    procedure SetColor(Value: TColor); {$IFDEF FPC}override;{$ENDIF}
+    procedure WMEraseBkgnd(var Message: {$IFDEF FPC}TLMEraseBkgnd{$ELSE}TWMEraseBkgnd{$ENDIF}); message {$IFDEF FPC}LM_ERASEBKGND{$ELSE}WM_ERASEBKGND{$ENDIF};
     procedure SetEnabled(Value: boolean); override;
   public
     { Public declarations }
@@ -100,6 +106,10 @@ type
     property Anchors;
     property AutoSize;
     property BorderSpacing;
+    property ChildSizing;
+    {$IFDEF FPC} //#
+    property OnGetDockCaption;
+    {$ENDIF}
     property BevelInner;
     property BevelOuter;
     property BevelWidth;
@@ -107,7 +117,6 @@ type
     property BorderWidth;
     property BorderStyle;
     property Caption;
-    property ChildSizing;
     property ClientHeight;
     property ClientWidth;
     property Color;
@@ -141,7 +150,6 @@ type
     property OnEnter;
     property OnExit;
     property OnGetSiteInfo;
-    property OnGetDockCaption;
     property OnMouseDown;
     property OnMouseEnter;
     property OnMouseLeave;
@@ -156,18 +164,19 @@ type
     property OnUnDock;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
-uses BGRABitmapTypes, Types, LCLIntf, math;
+uses BGRABitmapTypes, math;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\bgravirtualscreen_icon.lrs}
   RegisterComponents('BGRA Controls', [TBGRAVirtualScreen]);
 end;
-
+{$ENDIF}
 { TCustomBGRAVirtualScreen }
 
 procedure TCustomBGRAVirtualScreen.SetAlignment(const Value: TAlignment);
@@ -273,12 +282,16 @@ begin
     if Caption <> '' then
     begin
       FBGRA.CanvasBGRA.Font.Assign(Canvas.Font);
+      {$IFDEF FPC}//#
       TS := Canvas.TextStyle;
+      {$ENDIF}
       TS.Alignment := Alignment;
       TS.Layout := tlTop;
       TS.Opaque := False;
       TS.Clipping := False;
+      {$IFDEF FPC}//#
       TS.SystemFont := Canvas.Font.IsDefault;
+      {$ENDIF}
 
       FBGRA.CanvasBGRA.Font.Color := Color xor $FFFFFF;
 
@@ -299,11 +312,14 @@ procedure TCustomBGRAVirtualScreen.SetColor(Value: TColor);
 begin
   if Value <> Color then
     DiscardBitmap;
+
+  {$IFDEF FPC}
   inherited SetColor(Value);
+  {$ENDIF}
 end;
 
 {$hints off}
-procedure TCustomBGRAVirtualScreen.WMEraseBkgnd(var Message: TLMEraseBkgnd);
+procedure TCustomBGRAVirtualScreen.WMEraseBkgnd(var Message: {$IFDEF FPC}TLMEraseBkgnd{$ELSE}TWMEraseBkgnd{$ENDIF});
 begin
   //do nothing
 end;

+ 17 - 9
colorspeedbutton.pas

@@ -1,6 +1,11 @@
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit ColorSpeedButton;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 {$ifdef windows}
 {$define overridepaint}
@@ -9,8 +14,9 @@ unit ColorSpeedButton;
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  Buttons, BGRASpeedButton, Types, LCLType, Themes, LCLProc, Math;
+  Classes, SysUtils, Types, {$IFDEF FPC}LCLType, LCLProc, LResources,{$ENDIF}
+  {$IFNDEF FPC}BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  Forms, Controls, Graphics, Dialogs, Buttons, BGRASpeedButton, Themes, Math;
 
 type
 
@@ -37,9 +43,7 @@ type
 
   TColorSpeedButton = class(TBGRASpeedButton)
   private
-    {$ifdef overridepaint}
     FLastDrawDetails: TThemedElementDetails;
-    {$endif}
     FPopupMode: boolean;
     FPressed: boolean;
     FStateActive: TColorState;
@@ -66,7 +70,7 @@ type
     procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
       WithThemeSpace: boolean); override;
     {$endif}
-    procedure PaintBackground(var PaintRect: TRect); override;
+    procedure PaintBackground(var PaintRect: TRect); {$IFDEF FPC}override;{$ENDIF}
   public
     constructor Create(TheOwner: TComponent); override;
     destructor Destroy; override;
@@ -82,14 +86,16 @@ type
     property StateDisabled: TColorState read FStateDisabled write SetFStateDisabled;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
-  RegisterComponents('BGRA Button Controls', [TColorSpeedButton]);
+  RegisterComponents('BGRA Controls', [TColorSpeedButton]);
 end;
+{$ENDIF}
 
 { TColorSpeedButton }
 
@@ -493,12 +499,14 @@ begin
       Canvas.Pen.Width := FStateActive.BorderWidth;
       Canvas.Brush.Color := FStateActive.Color;
     end;
+{$IFDEF FPC}//#
     bsHot:
     begin
       Canvas.Pen.Color := FStateHover.BorderColor;
       Canvas.Pen.Width := FStateHover.BorderWidth;
       Canvas.Brush.Color := FStateHover.Color;
     end;
+{$ENDIF}
   end;
   if Canvas.Pen.Width = 0 then
     Canvas.Pen.Color := Canvas.Brush.Color;
@@ -520,7 +528,7 @@ begin
   FStateActive.Color := RGBToColor(204, 228, 247);
   FStateActive.BorderColor := RGBToColor(0, 84, 153);
   FStateDisabled.Color := RGBToColor(204, 204, 204);
-  FStateDisabled.BorderColor := RGBToColor(191, 191, 191);
+  FStateDisabled.Color := RGBToColor(191, 191, 191);
   Font.Color := clBlack;
   FTextAutoSize := True;
 end;

+ 16 - 7
dtanalogclock.pas

@@ -32,22 +32,29 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit DTAnalogClock;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
-  BGRABitmap, BGRABitmapTypes, BGRAGradients;
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ENDIF}
+  Forms, Controls, Graphics, Dialogs, ExtCtrls,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, BGRAGradients;
 
 type
   TClockStyle = (stlBlue, stlGreen, stlWhite);
 
   { TDTCustomAnalogClock }
 
-  TDTCustomAnalogClock = class(TGraphicControl)
+  TDTCustomAnalogClock = class(TBGRAGraphicCtrl)
   private
     FClockStyle: TClockStyle;
     FBitmap: TBGRABitmap;
@@ -89,7 +96,7 @@ type
     property Enabled;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -99,7 +106,7 @@ constructor TDTCustomAnalogClock.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  OnResize := @ResizeEvent;
+  OnResize := ResizeEvent;
 
   Width := 128;
   Height := 128;
@@ -117,7 +124,7 @@ begin
   FTimer := TTimer.Create(Self);
   FTimer.Interval := 1000;
   FTimer.Enabled := FEnabled;
-  FTimer.OnTimer := @TimerEvent;
+  FTimer.OnTimer := TimerEvent;
 
 end;
 
@@ -311,11 +318,13 @@ begin
   Refresh;
 end;
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\dtanalogclock_icon.lrs}
   RegisterComponents('BGRA Controls', [TDTAnalogClock]);
 end;
+{$ENDIF}
 
 
 end.

+ 902 - 0
dtanalogcommon.pas

@@ -0,0 +1,902 @@
+{
+  Part of BGRA Controls. Made by third party.
+  For detailed information see readme.txt
+
+  Site: https://sourceforge.net/p/bgra-controls/
+  Wiki: http://wiki.lazarus.freepascal.org/BGRAControls
+  Forum: http://forum.lazarus.freepascal.org/index.php/board,46.0.html
+
+  This library is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Library General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or (at your
+  option) any later version with the following modification:
+
+  As a special exception, the copyright holders of this library give you
+  permission to link this library with independent modules to produce an
+  executable, regardless of the license terms of these independent modules,and
+  to copy and distribute the resulting executable under terms of your choice,
+  provided that you also meet, for each linked independent module, the terms
+  and conditions of the license of that module. An independent module is a
+  module which is not derived from or based on this library. If you modify
+  this library, you may extend this exception to your version of the library,
+  but you are not obligated to do so. If you do not wish to do so, delete this
+  exception statement from your version.
+
+  This program is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
+  for more details.
+
+  You should have received a copy of the GNU Library General Public License
+  along with this library; if not, write to the Free Software Foundation,
+  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+unit DTAnalogCommon;
+
+{$I bgracontrols.inc}
+
+interface
+
+uses
+  Classes, SysUtils, {$IFDEF FPC}LResources,{$ELSE}Types, {$ENDIF} Forms, Controls, Graphics, Dialogs,
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes;
+
+type
+  TDTFillStyle = (fsnone, fsGradient{, fsTexture});
+
+  TDTNeedleStyle = (nsLine, nsTriangle{, nsLineExt, nsTriangleExt});
+
+  { TDTOrigin }
+
+  TDTOrigin = packed record
+    CenterPoint: TPoint;
+    Radius: integer;
+  end;
+
+  { TDTPointerCapSettings }
+
+  TDTPointerCapSettings = class(TPersistent)
+  private
+    FEdgeColor: TColor;
+    FEdgeThickness: integer;
+    FFillColor: TColor;
+    FOnChange: TNotifyEvent;
+    FRadius: integer;
+    procedure SetEdgeColor(AValue: TColor);
+    procedure SetEdgeThickness(AValue: integer);
+    procedure SetFillColor(AValue: TColor);
+    procedure SetOnChange(AValue: TNotifyEvent);
+    procedure SetRadius(AValue: integer);
+  protected
+  public
+    constructor Create;
+    destructor Destroy; override;
+    property OnChange: TNotifyEvent read FOnChange write SetOnChange;
+  published
+    property EdgeColor: TColor read FEdgeColor write SetEdgeColor;
+    property FillColor: TColor read FFillColor write SetFillColor;
+    property Radius: integer read FRadius write SetRadius;
+    property EdgeThickness: integer read FEdgeThickness write SetEdgeThickness;
+  end;
+
+  { TDTPointerSettings }
+
+  TDTPointerSettings = class(TPersistent)
+  private
+    FColor: TColor;
+    FLength: integer;
+    FOnChange: TNotifyEvent;
+    FThickness: integer;
+    procedure SetColor(AValue: TColor);
+    procedure SetLength(AValue: integer);
+    procedure SetOnChange(AValue: TNotifyEvent);
+    procedure SetThickness(AValue: integer);
+  protected
+  public
+    constructor Create;
+    destructor Destroy; override;
+    property OnChange: TNotifyEvent read FOnChange write SetOnChange;
+  published
+    property Color: TColor read FColor write SetColor;
+    property Length: integer read FLength write SetLength;
+    property Thickness: integer read FThickness write SetThickness;
+  end;
+
+  { TDTNeedleSettings }
+
+  TDTNeedleSettings = class(TPersistent)
+  private
+    FCapColor: TColor;
+    FCapEdgeColor: TColor;
+    FCapRadius: integer;
+    FNeedleColor: TColor;
+    FNeedleLength: integer;
+    FNeedleStyle: TDTNeedleStyle;
+    FOnChange: TNotifyEvent;
+    procedure SetCapColor(AValue: TColor);
+    procedure SetCapEdgeColor(AValue: TColor);
+    procedure SetCapRadius(AValue: integer);
+    procedure SetNeedleColor(AValue: TColor);
+    procedure SetNeedleLength(AValue: integer);
+    procedure SetNeedleStyle(AValue: TDTNeedleStyle);
+    procedure SetOnChange(AValue: TNotifyEvent);
+  protected
+  public
+    constructor Create;
+    destructor Destroy; override;
+    property OnChange: TNotifyEvent read FOnChange write SetOnChange;
+    property NeedleStyle: TDTNeedleStyle read FNeedleStyle write SetNeedleStyle;
+  published
+    property NeedleColor: TColor read FNeedleColor write SetNeedleColor;
+    property NeedleLength: integer read FNeedleLength write SetNeedleLength;
+    property CapRadius: integer read FCapRadius write SetCapRadius;
+    property CapColor: TColor read FCapColor write SetCapColor;
+    property CapEdgeColor: TColor read FCapEdgeColor write SetCapEdgeColor;
+  end;
+
+  { TDTScaleSettings }
+
+  TDTScaleSettings = class(TPersistent)
+  private
+    FEnableScaleText: boolean;
+    FMaximum: integer;
+    FTesting: boolean;
+    FTextFont: string;
+    FTextRadius: integer;
+    FTextSize: integer;
+    FTickColor: TColor;
+    FEnableMainTicks: boolean;
+    FEnableRangeIndicator: boolean;
+    FEnableSubTicks: boolean;
+    FLengthMainTick: integer;
+    FLengthSubTick: integer;
+    FMainTickCount: integer;
+    FMinimum: integer;
+    FOnChange: TNotifyEvent;
+    FSubTickCount: integer;
+    FTextColor: TColor;
+    FThicknessMainTick: integer;
+    FThicknessSubTick: integer;
+    FAngle: integer;
+    procedure SetEnableScaleText(AValue: boolean);
+    procedure SetFAngle(AValue: integer);
+    procedure SetMaximum(AValue: integer);
+    procedure SetTesting(AValue: boolean);
+    procedure SetTextFont(AValue: string);
+    procedure SetTextRadius(AValue: integer);
+    procedure SetTextSize(AValue: integer);
+    procedure SetTickColor(AValue: TColor);
+    procedure SetEnableMainTicks(AValue: boolean);
+    procedure SetEnableRangeIndicator(AValue: boolean);
+    procedure SetEnableSubTicks(AValue: boolean);
+    procedure SetLengthMainTick(AValue: integer);
+    procedure SetLengthSubTick(AValue: integer);
+    procedure SetMainTickCount(AValue: integer);
+    procedure SetOnChange(AValue: TNotifyEvent);
+    procedure SetSubTickCount(AValue: integer);
+    procedure SetTextColor(AValue: TColor);
+    procedure SetThicknessMainTick(AValue: integer);
+    procedure SetThicknessSubTick(AValue: integer);
+  protected
+    property Testing: boolean read FTesting write SetTesting;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    property OnChange: TNotifyEvent read FOnChange write SetOnChange;
+  published
+    property TickColor: TColor read FTickColor write SetTickColor;
+    property TextColor: TColor read FTextColor write SetTextColor;
+    property TextSize: integer read FTextSize write SetTextSize;
+    property TextFont: string read FTextFont write SetTextFont;
+    property EnableMainTicks: boolean read FEnableMainTicks write SetEnableMainTicks;
+    property EnableSubTicks: boolean read FEnableSubTicks write SetEnableSubTicks;
+    property EnableScaleText: boolean read FEnableScaleText write SetEnableScaleText;
+    property Maximum: integer read FMaximum write SetMaximum;
+    property MainTickCount: integer read FMainTickCount write SetMainTickCount;
+    property SubTickCount: integer read FSubTickCount write SetSubTickCount;
+    property LengthMainTick: integer read FLengthMainTick write SetLengthMainTick;
+    property LengthSubTick: integer read FLengthSubTick write SetLengthSubTick;
+    property ThicknessMainTick: integer read FThicknessMainTick write SetThicknessMainTick;
+    property ThicknessSubTick: integer read FThicknessSubTick write SetThicknessSubTick;
+    property TextRadius: integer read FTextRadius write SetTextRadius;
+    property Angle: integer read FAngle write SetFAngle;
+    property EnableRangeIndicator: boolean read FEnableRangeIndicator write SetEnableRangeIndicator;
+    //property RangeMinValue: integer read FRangeMinValue write SetRangeMinValue;
+    //property RangeMidValue: integer read FRangeMidValue write SetRangeMidValue;
+    //property RangeMaxValue: integer read FRangeMaxValue write SetRangeMaxValue;
+    //property RangeMinColor: TColor read FRangeMinColor write SetRangeMinColor;
+    //property RangeMidColor: TColor read FRangeMidColor write SetRangeMidColor;
+    //property RangeMaxColor: TColor read FRangeMaxColor write SetRangeMaxColor;
+  end;
+
+  { TDTFaceSettings }
+
+  TDTFaceSettings = class(TPersistent)
+  private
+    FColorEnd: TColor;
+    FColorFrame: TColor;
+    FColorStart: TColor;
+    FFillStyle: TDTFillStyle;
+    FOnChange: TNotifyEvent;
+    procedure SetColorEnd(AValue: TColor);
+    procedure SetColorFrame(AValue: TColor);
+    procedure SetColorStart(AValue: TColor);
+    procedure SetFillStyle(AValue: TDTFillStyle);
+    procedure SetOnChange(AValue: TNotifyEvent);
+  protected
+  public
+    constructor Create;
+    destructor Destroy; override;
+    property OnChange: TNotifyEvent read FOnChange write SetOnChange;
+  published
+    property FillStyle: TDTFillStyle read FFillStyle write SetFillStyle;
+    property ColorFrame: TColor read FColorFrame write SetColorFrame;
+    property ColorStart: TColor read FColorStart write SetColorStart;
+    property ColorEnd: TColor read FColorEnd write SetColorEnd;
+  end;
+
+  { TDTBaseAnalogDevice }
+
+  TDTBaseAnalogDevice = class(TBGRAGraphicCtrl)
+  private
+    FFaceSettings: TDTFaceSettings;
+    FScaleSettings: TDTScaleSettings;
+    procedure SetFaceSettings(AValue: TDTFaceSettings);
+    procedure SetScaleSettings(AValue: TDTScaleSettings);
+  protected
+    procedure DoChange({%H-}Sender: TObject);
+  public
+    fGaugeBitmap: TBGRABitmap;
+    FFrameBitmap: TBGRABitmap;
+    FFaceBitmap: TBGRABitmap;
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    property FaceSettings: TDTFaceSettings read FFaceSettings write SetFaceSettings;
+    property ScaleSettings: TDTScaleSettings read FScaleSettings write SetScaleSettings;
+    procedure Paint; override;
+    procedure DrawGauge;
+    procedure DrawFrame;
+    procedure DrawFace;
+  end;
+
+function Initializebitmap(var Bitmap: TBGRABitmap; Width, Height: integer): TDTOrigin;
+
+implementation
+
+function Initializebitmap(var Bitmap: TBGRABitmap; Width, Height: integer): TDTOrigin;
+begin
+
+  Bitmap.SetSize(Width, Height);
+
+  // Clear bitmap to transparent
+  BitMap.Fill(BGRA(0, 0, 0, 0));
+
+  // Get origin information
+  Result.CenterPoint.x := Width div 2;
+  Result.CenterPoint.y := Height div 2;
+
+  Result.Radius := Result.CenterPoint.y;
+
+  if Result.CenterPoint.x > Result.CenterPoint.y then
+    Result.Radius := Result.CenterPoint.y;
+
+  if Result.CenterPoint.x < Result.CenterPoint.y then
+    Result.Radius := Result.CenterPoint.x;
+
+end;
+
+{ TDTPointerCapSettings }
+
+procedure TDTPointerCapSettings.SetEdgeColor(AValue: TColor);
+begin
+  if FEdgeColor = AValue then
+    Exit;
+  FEdgeColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTPointerCapSettings.SetEdgeThickness(AValue: integer);
+begin
+  if FEdgeThickness = AValue then
+    Exit;
+  FEdgeThickness := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTPointerCapSettings.SetFillColor(AValue: TColor);
+begin
+  if FFillColor = AValue then
+    Exit;
+  FFillColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTPointerCapSettings.SetOnChange(AValue: TNotifyEvent);
+begin
+//#  if FOnChange = AValue then
+//#    Exit;
+  FOnChange := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTPointerCapSettings.SetRadius(AValue: integer);
+begin
+  if FRadius = AValue then
+    Exit;
+  FRadius := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+constructor TDTPointerCapSettings.Create;
+begin
+  FEdgeColor := $00CCDCDC;
+  FFillColor := $003F3F3F;
+  FRadius := 10;
+  FEdgeThickness := 1;
+end;
+
+destructor TDTPointerCapSettings.Destroy;
+begin
+  inherited Destroy;
+end;
+
+{ TDTPointerSettings }
+
+procedure TDTPointerSettings.SetColor(AValue: TColor);
+begin
+  if FColor = AValue then
+    Exit;
+  FColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTPointerSettings.SetLength(AValue: integer);
+begin
+  if FLength = AValue then
+    Exit;
+  FLength := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTPointerSettings.SetOnChange(AValue: TNotifyEvent);
+begin
+//#  if FOnChange = AValue then
+//#    Exit;
+  FOnChange := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTPointerSettings.SetThickness(AValue: integer);
+begin
+  if FThickness = AValue then
+    Exit;
+  FThickness := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+constructor TDTPointerSettings.Create;
+begin
+  FColor := BGRA(199, 199, 173);
+  FLength := 100;
+  FThickness := 3;
+end;
+
+destructor TDTPointerSettings.Destroy;
+begin
+  inherited Destroy;
+end;
+
+{ TDTBaseAnalogDevice }
+
+procedure TDTBaseAnalogDevice.SetFaceSettings(AValue: TDTFaceSettings);
+begin
+  if FFaceSettings = AValue then
+    Exit;
+  FFaceSettings := AValue;
+
+  DoChange(self);
+end;
+
+procedure TDTBaseAnalogDevice.SetScaleSettings(AValue: TDTScaleSettings);
+begin
+  if FScaleSettings = AValue then
+    Exit;
+  FScaleSettings := AValue;
+
+  DoChange(self);
+end;
+
+procedure TDTBaseAnalogDevice.DoChange(Sender: TObject);
+begin
+  Invalidate;
+end;
+
+constructor TDTBaseAnalogDevice.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  Width := 240;
+  Height := 240;
+
+  FScaleSettings := TDTScaleSettings.Create;
+  ScaleSettings.OnChange := DoChange;
+
+  ScaleSettings.TextRadius := round((Width * 0.6) / 2);
+
+  FFaceSettings := TDTFaceSettings.Create;
+  FaceSettings.OnChange := DoChange;
+
+  FGaugeBitmap := TBGRABitmap.Create;
+  FFaceBitmap := TBGRABitmap.Create;
+  FFrameBitmap := TBGRABitmap.Create;
+
+end;
+
+destructor TDTBaseAnalogDevice.Destroy;
+begin
+  FScaleSettings.Free;
+  FFaceSettings.Free;
+
+  fGaugeBitmap.Free;
+  FFaceBitmap.Free;
+  FFrameBitmap.Free;
+  inherited Destroy;
+end;
+
+procedure TDTBaseAnalogDevice.Paint;
+begin
+  inherited Paint;
+  FGaugeBitmap.Fill(BGRA(0, 0, 0, 0));
+
+  fGaugeBitmap.SetSize(Width, Height);
+
+  DrawGauge;
+
+  FGaugeBitmap.BlendImage(0, 0, FFrameBitmap, boLinearBlend);
+  FGaugeBitmap.BlendImage(0, 0, FFaceBitmap, boLinearBlend);
+
+  FGaugeBitmap.Draw(Canvas, 0, 0, False);
+
+end;
+
+procedure TDTBaseAnalogDevice.DrawGauge;
+begin
+  DrawFrame;
+  DrawFace;
+end;
+
+procedure TDTBaseAnalogDevice.DrawFrame;
+var
+  Origin: TDTOrigin;
+  r: integer;
+begin
+
+  Origin := Initializebitmap(FFrameBitmap, Width, Height);
+
+  r := round(Origin.Radius * 0.95);
+
+  // Draw Bitmap frame
+  FFrameBitmap.FillEllipseAntialias(Origin.CenterPoint.x,
+    Origin.CenterPoint.y,
+    r, r, FFaceSettings.ColorFrame);
+
+  // Draw thin antialiased border to smooth against background
+  FFrameBitmap.EllipseAntialias(Origin.CenterPoint.x,
+    Origin.CenterPoint.y,
+    r, r, ColorToBGRA(clBlack, 120), 1);
+
+end;
+
+procedure TDTBaseAnalogDevice.DrawFace;
+var
+  Origin: TDTOrigin;
+  r: integer;
+begin
+
+  Origin := Initializebitmap(FFaceBitmap, Width, Height);
+
+  r := round(Origin.Radius * 0.95) - 5;
+
+  case FFaceSettings.FillStyle of
+    fsGradient:
+      FFaceBitmap.FillEllipseLinearColorAntialias(Origin.CenterPoint.x, Origin.CenterPoint.y, r, r, ColorToBGRA(FFaceSettings.ColorStart), ColorToBGRA(FFaceSettings.ColorEnd));
+    fsnone:
+      FFaceBitmap.FillEllipseAntialias(Origin.CenterPoint.x, Origin.CenterPoint.y, r, r, FFaceSettings.ColorStart);
+  end;
+
+end;
+
+{ TDTNeedleSettings }
+
+procedure TDTNeedleSettings.SetCapColor(AValue: TColor);
+begin
+  if FCapColor = AValue then
+    Exit;
+  FCapColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTNeedleSettings.SetCapEdgeColor(AValue: TColor);
+begin
+  if FCapEdgeColor = AValue then
+    Exit;
+  FCapEdgeColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTNeedleSettings.SetCapRadius(AValue: integer);
+begin
+  if FCapRadius = AValue then
+    Exit;
+  FCapRadius := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTNeedleSettings.SetNeedleColor(AValue: TColor);
+begin
+  if FNeedleColor = AValue then
+    Exit;
+  FNeedleColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTNeedleSettings.SetNeedleLength(AValue: integer);
+begin
+  if FNeedleLength = AValue then
+    Exit;
+  FNeedleLength := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTNeedleSettings.SetNeedleStyle(AValue: TDTNeedleStyle);
+begin
+  if FNeedleStyle = AValue then
+    Exit;
+  FNeedleStyle := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTNeedleSettings.SetOnChange(AValue: TNotifyEvent);
+begin
+//#  if FOnChange = AValue then
+//#    Exit;
+  FOnChange := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+constructor TDTNeedleSettings.Create;
+begin
+  FCapColor := BGRA(63, 63, 63);
+  FCapEdgeColor := BGRA(220, 220, 204);
+  FCapRadius := 10;
+
+  FNeedleStyle := nsLine;
+  FNeedleColor := BGRA(255, 81, 81);
+  FNeedleLength := 100;
+end;
+
+destructor TDTNeedleSettings.Destroy;
+begin
+  inherited Destroy;
+end;
+
+{ TDTScaleSettings }
+
+constructor TDTScaleSettings.Create;
+begin
+  FTickColor := bgra(223, 196, 125);
+  FTextColor := bgra(140, 208, 211);
+  FTextFont := 'Calibri';
+  FTextSize := 15;
+  FEnableMainTicks := True;
+  FEnableSubTicks := True;
+  FEnableScaleText := True;
+  FMainTickCount := 10;
+  FSubTickCount := 5;
+  FMaximum := 100;
+  FMinimum := 0;
+  FLengthMainTick := 15;
+  FLengthSubTick := 8;
+  FThicknessMainTick := 3;
+  FThicknessSubTick := 1;
+  FAngle := 300;
+  FEnableRangeIndicator := True;
+end;
+
+destructor TDTScaleSettings.Destroy;
+begin
+  inherited Destroy;
+end;
+
+procedure TDTScaleSettings.SetTextFont(AValue: string);
+begin
+  if FTextFont = AValue then
+    Exit;
+  FTextFont := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetEnableScaleText(AValue: boolean);
+begin
+  if FEnableScaleText = AValue then
+    Exit;
+  FEnableScaleText := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetFAngle(AValue: integer);
+begin
+  if FAngle=AValue then Exit;
+  FAngle:=AValue;
+end;
+
+procedure TDTScaleSettings.SetMaximum(AValue: integer);
+begin
+  if FMaximum = AValue then
+    Exit;
+  FMaximum := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetTesting(AValue: boolean);
+begin
+  if FTesting = AValue then
+    Exit;
+  FTesting := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetTextRadius(AValue: integer);
+begin
+  if FTextRadius = AValue then
+    Exit;
+  FTextRadius := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetTextSize(AValue: integer);
+begin
+  if FTextSize = AValue then
+    Exit;
+  FTextSize := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetTickColor(AValue: TColor);
+begin
+  if FTickColor = AValue then
+    Exit;
+  FTickColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetEnableMainTicks(AValue: boolean);
+begin
+  if FEnableMainTicks = AValue then
+    Exit;
+  FEnableMainTicks := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetEnableRangeIndicator(AValue: boolean);
+begin
+  if FEnableRangeIndicator = AValue then
+    Exit;
+  FEnableRangeIndicator := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetEnableSubTicks(AValue: boolean);
+begin
+  if FEnableSubTicks = AValue then
+    Exit;
+  FEnableSubTicks := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetLengthMainTick(AValue: integer);
+begin
+  if FLengthMainTick = AValue then
+    Exit;
+  FLengthMainTick := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetLengthSubTick(AValue: integer);
+begin
+  if FLengthSubTick = AValue then
+    Exit;
+  FLengthSubTick := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetMainTickCount(AValue: integer);
+begin
+  if FMainTickCount = AValue then
+    Exit;
+  FMainTickCount := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetOnChange(AValue: TNotifyEvent);
+begin
+//#  if FOnChange = AValue then
+//#    Exit;
+  FOnChange := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetSubTickCount(AValue: integer);
+begin
+  if FSubTickCount = AValue then
+    Exit;
+  FSubTickCount := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetTextColor(AValue: TColor);
+begin
+  if FTextColor = AValue then
+    Exit;
+  FTextColor := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetThicknessMainTick(AValue: integer);
+begin
+  if FThicknessMainTick = AValue then
+    Exit;
+  FThicknessMainTick := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTScaleSettings.SetThicknessSubTick(AValue: integer);
+begin
+  if FThicknessSubTick = AValue then
+    Exit;
+  FThicknessSubTick := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+{ TDTFaceSettings }
+
+constructor TDTFaceSettings.Create;
+begin
+  FColorFrame := BGRA(35, 35, 35);
+  FColorStart := BGRA(63, 63, 63);
+  FColorEnd := BGRA(93, 93, 93);
+  FFillStyle := fsGradient;
+end;
+
+destructor TDTFaceSettings.Destroy;
+begin
+  inherited Destroy;
+end;
+
+procedure TDTFaceSettings.SetColorEnd(AValue: TColor);
+begin
+  if FColorEnd = AValue then
+    Exit;
+  FColorEnd := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTFaceSettings.SetColorFrame(AValue: TColor);
+begin
+  if FColorFrame = AValue then
+    Exit;
+  FColorFrame := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTFaceSettings.SetColorStart(AValue: TColor);
+begin
+  if FColorStart = AValue then
+    Exit;
+  FColorStart := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTFaceSettings.SetFillStyle(AValue: TDTFillStyle);
+begin
+  if FFillStyle = AValue then
+    Exit;
+  FFillStyle := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TDTFaceSettings.SetOnChange(AValue: TNotifyEvent);
+begin
+//#  if FOnChange = AValue then
+//3    Exit;
+  FOnChange := AValue;
+
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+{ TDTBackGround }
+
+end.

+ 496 - 0
dtanaloggauge.pas

@@ -0,0 +1,496 @@
+{
+  Part of BGRA Controls. Made by third party.
+  For detailed information see readme.txt
+
+  Site: https://sourceforge.net/p/bgra-controls/
+  Wiki: http://wiki.lazarus.freepascal.org/BGRAControls
+  Forum: http://forum.lazarus.freepascal.org/index.php/board,46.0.html
+
+  This library is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Library General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or (at your
+  option) any later version with the following modification:
+
+  As a special exception, the copyright holders of this library give you
+  permission to link this library with independent modules to produce an
+  executable, regardless of the license terms of these independent modules,and
+  to copy and distribute the resulting executable under terms of your choice,
+  provided that you also meet, for each linked independent module, the terms
+  and conditions of the license of that module. An independent module is a
+  module which is not derived from or based on this library. If you modify
+  this library, you may extend this exception to your version of the library,
+  but you are not obligated to do so. If you do not wish to do so, delete this
+  exception statement from your version.
+
+  This program is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
+  for more details.
+
+  You should have received a copy of the GNU Library General Public License
+  along with this library; if not, write to the Free Software Foundation,
+  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+unit DTAnalogGauge;
+
+{$I bgracontrols.inc}
+
+interface
+
+uses
+  Classes, SysUtils, Graphics, {$IFDEF FPC}LResources, {$ELSE} BGRAGraphics, {$ENDIF}Forms, Controls, Dialogs, DTAnalogCommon,
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes;
+
+type
+
+  TDTGaugeStyle = (gsCustom, gsDark, gsLight);
+
+
+  { TDTCustomAnalogGauge }
+
+  TDTCustomAnalogGauge = class(TBGRAGraphicCtrl)
+  private
+    FFaceSettings: TDTFaceSettings;
+    FGaugeStyle: TDTGaugeStyle;
+    FNeedleSettings: TDTNeedleSettings;
+    FPosition: integer;
+    FResized: boolean;
+    FGaugeBitmap: TBGRABitmap;
+    FGaugeBodyBitmap: TBGRABitmap;
+    FGaugeScaleBitmap: TBGRABitmap;
+    FGaugeNeedleBitmap: TBGRABitmap;
+    FScaleSettings: TDTScaleSettings;
+    procedure SetFaceSettings(AValue: TDTFaceSettings);
+    procedure DoChange({%H-}Sender: TObject);
+    procedure SetGaugeStyle(AValue: TDTGaugeStyle);
+    procedure SetNeedleSettings(AValue: TDTNeedleSettings);
+    procedure SetPosition(AValue: integer);
+    procedure SetScaleSettings(AValue: TDTScaleSettings);
+    { Private declarations }
+  protected
+    { Protected declarations }
+    procedure ResizeEvent({%H-}Sender: TObject);
+    procedure ClearBitMap(var BitMap: TBGRABitmap);
+  public
+    { Public declarations }
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    procedure Paint; override;
+    procedure DrawGauge; virtual;
+    procedure DrawGaugeBody; virtual;
+    procedure DrawGaugeRange; virtual;
+    procedure DrawGaugeFace; virtual;
+    procedure DrawGaugeScale; virtual;
+    procedure DrawGaugeNeedle; virtual;
+  published
+    { Published declarations }
+    property Position: integer read FPosition write SetPosition;
+    property FaceSettings: TDTFaceSettings read FFaceSettings write SetFaceSettings;
+    property ScaleSettings: TDTScaleSettings read FScaleSettings write SetScaleSettings;
+    property NeedleSettings: TDTNeedleSettings read FNeedleSettings write SetNeedleSettings;
+    //property GaugeStyle: TDTGaugeStyle read FGaugeStyle write SetGaugeStyle;
+  end;
+
+  { TDTAnalogGauge }
+
+  TDTAnalogGauge = class(TDTCustomAnalogGauge)
+  private
+    { Private declarations }
+  protected
+    { Protected declarations }
+  public
+    { Public declarations }
+  published
+    { Published declarations }
+    property FaceSettings;
+    property ScaleSettings;
+    property NeedleSettings;
+  end;
+
+{$IFDEF FPC}procedure Register;{$ENDIF}
+
+implementation
+
+{$IFDEF FPC}
+procedure Register;
+begin
+  //{$I icons\dtanaloggauge_icon.lrs}
+  RegisterComponents('BGRA Controls', [TDTAnalogGauge]);
+end;
+{$ENDIF}
+
+{ TDTCustomAnalogGauge }
+
+procedure TDTCustomAnalogGauge.ClearBitMap(var BitMap: TBGRABitmap);
+begin
+  BitMap.Fill(BGRA(0, 0, 0, 0));
+end;
+
+constructor TDTCustomAnalogGauge.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  Width := 240;
+  Height := 240;
+
+  FScaleSettings := TDTScaleSettings.Create;
+  ScaleSettings.OnChange := DoChange;
+
+  FFaceSettings := TDTFaceSettings.Create;
+  FaceSettings.OnChange := DoChange;
+
+  FNeedleSettings := TDTNeedleSettings.Create;
+  NeedleSettings.OnChange := DoChange;
+
+  FGaugeBitmap := TBGRABitmap.Create(Width, Height);
+  FGaugeBodyBitmap := TBGRABitmap.Create(Width, Height);
+  FGaugeScaleBitmap := TBGRABitmap.Create(Width, Height);
+  FGaugeNeedleBitmap := TBGRABitmap.Create(Width, Height);
+
+end;
+
+destructor TDTCustomAnalogGauge.Destroy;
+begin
+  FScaleSettings.OnChange:=nil;
+  FScaleSettings.Free;
+  FFaceSettings.OnChange:=nil;
+  FFaceSettings.Free;
+  FGaugeBitmap.Free;
+  FGaugeBodyBitmap.Free;
+  FGaugeScaleBitmap.Free;
+  FGaugeNeedleBitmap.Free;
+  FNeedleSettings.OnChange:=nil;
+  FNeedleSettings.Free;
+  inherited Destroy;
+end;
+
+procedure TDTCustomAnalogGauge.DoChange(Sender: TObject);
+begin
+  Invalidate;
+end;
+
+procedure TDTCustomAnalogGauge.SetGaugeStyle(AValue: TDTGaugeStyle);
+begin
+  if FGaugeStyle = AValue then
+    Exit;
+  FGaugeStyle := AValue;
+
+  DoChange(self);
+
+end;
+
+procedure TDTCustomAnalogGauge.SetNeedleSettings(AValue: TDTNeedleSettings);
+begin
+  if FNeedleSettings = AValue then
+    Exit;
+  FNeedleSettings := AValue;
+
+  DoChange(self);
+
+end;
+
+procedure TDTCustomAnalogGauge.DrawGauge;
+begin
+  DrawGaugeBody;
+  DrawGaugeFace;
+
+  if FScaleSettings.EnableRangeIndicator then
+    DrawGaugeRange;
+
+  DrawGaugeScale;
+  DrawGaugeNeedle;
+end;
+
+procedure TDTCustomAnalogGauge.DrawGaugeBody;
+var
+  r: integer;
+  origin: TDTOrigin;
+begin
+
+  origin := Initializebitmap(FGaugeBodyBitmap, Width, Height);
+
+  //// Keep circle insde frame
+  r := round(origin.Radius * 0.95);
+
+  // Draw Bitmap frame
+  FGaugeBodyBitmap.FillEllipseAntialias(origin.CenterPoint.x,
+    origin.CenterPoint.y,
+    r, r, FFaceSettings.ColorFrame);
+
+  // Draw thin antialiased border to smooth against background
+  FGaugeBodyBitmap.EllipseAntialias(origin.CenterPoint.x,
+    origin.CenterPoint.y,
+    r, r, ColorToBGRA(clBlack, 120), 1);
+
+end;
+
+procedure TDTCustomAnalogGauge.DrawGaugeRange;
+var
+  {%H-}r, w, h, Xo, Yo: integer;
+begin
+
+  ClearBitMap(FGaugeScaleBitmap);
+
+  w := Width;
+  h := Height;
+
+  FGaugeScaleBitmap.SetSize(w, h);
+
+  { Set center point }
+  Xo := w div 2;
+  Yo := h div 2;
+
+  // Determine radius. If canvas is rectangular then r = shortest length w or h
+  r := yo;
+
+  if xo > yo then
+    r := yo;
+
+  if xo < yo then
+    r := xo;
+
+  //j := (180 - FScaleSettings.Angle) / 2;
+
+end;
+
+procedure TDTCustomAnalogGauge.DrawGaugeFace;
+var
+  w, h, r, Xo, Yo: integer;
+begin
+  ClearBitMap(FGaugeScaleBitmap);
+
+  w := Width;
+  h := Height;
+
+  FGaugeBodyBitmap.SetSize(w, h);
+
+  //{ Set center point }
+  Xo := w div 2;
+  Yo := h div 2;
+
+  //  // Determine radius. If canvas is rectangular then r = shortest length w or h
+  r := yo;
+
+  if xo > yo then
+    r := yo;
+
+  if xo < yo then
+    r := xo;
+
+  // Keep circle insde frame
+  r := round(r * 0.95) - 5;
+
+  // Draw face background
+  case FFaceSettings.FillStyle of
+    fsGradient:
+      FGaugeBodyBitmap.FillEllipseLinearColorAntialias(Xo, Yo, r, r, FFaceSettings.ColorStart, ColorToBGRA(FFaceSettings.ColorEnd));
+    fsnone:
+      FGaugeBodyBitmap.FillEllipseAntialias(Xo, Yo, r, r, FFaceSettings.ColorStart);
+  end;
+
+
+  //origin := Initializebitmap(FGaugeBodyBitmap, Width, Height);
+
+  //// Keep circle insde frame
+  //r := round(origin.Radius * 0.95) - 5;
+
+  //// Draw face background
+  //case FFaceSettings.FillStyle of
+  //  fsGradient:
+  //    FGaugeBodyBitmap.FillEllipseLinearColorAntialias(origin.CenterPoint.x, origin.CenterPoint.y, r, r, ColorToBGRA(FFaceSettings.ColorStart), ColorToBGRA(FFaceSettings.ColorEnd));
+  //  fsnone:
+  //    FGaugeBodyBitmap.FillEllipseAntialias(origin.CenterPoint.x, origin.CenterPoint.y, r, r, ColorToBGRA(FFaceSettings.ColorStart));
+  //end;
+
+end;
+
+procedure TDTCustomAnalogGauge.DrawGaugeScale;
+var
+  w, h, r, Xo, Yo, X, Y, Xt, Yt: integer;
+  i, n: integer;
+  j: single;
+begin
+
+  w := Width;
+  h := Height;
+
+  FGaugeScaleBitmap.SetSize(w, h);
+
+  ClearBitMap(FGaugeScaleBitmap);
+
+  { Set center point }
+  Xo := w div 2;
+  Yo := h div 2;
+
+  // Determine radius. If canvas is rectangular then r = shortest length w or h
+  r := yo;
+
+  if xo > yo then
+    r := yo;
+
+  if xo < yo then
+    r := xo;
+
+  j := (180 - FScaleSettings.Angle) / 2;
+
+  // Draw SubTicks
+  if FScaleSettings.EnableSubTicks then
+  begin
+
+    n := FScaleSettings.MainTickCount * FScaleSettings.SubTickCount;
+
+    for i := 0 to n do
+    begin
+      // Calculate draw from point
+      X := xo - Round(r * 0.85 * cos((j + i * FScaleSettings.Angle / n) * Pi / 180));
+      Y := yo - Round(r * 0.85 * sin((j + i * FScaleSettings.Angle / n) * Pi / 180));
+
+      // Calculate draw to point
+      Xt := xo - Round(((r * 0.85) - FScaleSettings.LengthSubTick) * cos((j + i * FScaleSettings.Angle / n) * Pi / 180));
+      Yt := yo - Round(((r * 0.85) - FScaleSettings.LengthSubTick) * sin((j + i * FScaleSettings.Angle / n) * Pi / 180));
+
+      FGaugeScaleBitmap.DrawLineAntialias(x, y, xt, yt, FScaleSettings.TickColor, FScaleSettings.ThicknessSubTick);
+
+    end;
+  end;
+
+  if FScaleSettings.EnableMainTicks then
+  begin
+
+    FGaugeScaleBitmap.FontName := FScaleSettings.TextFont;
+    FGaugeScaleBitmap.FontHeight := FScaleSettings.TextSize;
+    FGaugeScaleBitmap.FontQuality := fqFineAntialiasing;
+
+    n := FScaleSettings.MainTickCount;
+
+    for i := 0 to n do
+    begin
+      // Draw main ticks
+      // Calculate draw from point
+      X := xo - Round(r * 0.85 * cos((j + i * FScaleSettings.Angle / n) * Pi / 180));
+      Y := yo - Round(r * 0.85 * sin((j + i * FScaleSettings.Angle / n) * Pi / 180));
+
+      // Calculate draw to point
+      Xt := xo - Round(((r * 0.85) - FScaleSettings.LengthMainTick) * cos((j + i * FScaleSettings.Angle / n) * Pi / 180));
+      Yt := yo - Round(((r * 0.85) - FScaleSettings.LengthMainTick) * sin((j + i * FScaleSettings.Angle / n) * Pi / 180));
+
+      FGaugeScaleBitmap.DrawLineAntialias(x, y, xt, yt, FScaleSettings.TickColor, FScaleSettings.ThicknessMainTick);
+
+      // Draw text for main ticks
+      Xt := xo - Round((r - FScaleSettings.LengthMainTick) * 0.7 * cos((j + i * FScaleSettings.Angle / n) * Pi / 180));
+      Yt := yo - Round((r - FScaleSettings.LengthMainTick) * 0.7 * sin((j + i * FScaleSettings.Angle / n) * Pi / 180));
+
+      FGaugeScaleBitmap.TextOut(Xt, Yt - (FGaugeScaleBitmap.FontHeight / 1.7),
+        IntToStr(i * FScaleSettings.Maximum div FScaleSettings.MainTickCount),
+        //ColorToBGRA(FScaleSettings.TickColor),
+        FScaleSettings.TextColor,
+        taCenter);
+    end;
+  end;
+end;
+
+procedure TDTCustomAnalogGauge.DrawGaugeNeedle;
+var
+  w, h, Xo, Yo, X, Y: integer;
+  j: single;
+begin
+
+  ClearBitMap(FGaugeNeedleBitmap);
+
+  w := Width;
+  h := Height;
+
+  FGaugeNeedleBitmap.SetSize(w, h);
+
+  { Set center point }
+  Xo := w div 2;
+  Yo := h div 2;
+
+  j := (180 - FScaleSettings.Angle) / 2;
+
+  // Draw needle
+  case FNeedleSettings.NeedleStyle of
+    nsLine:
+    begin
+
+      X := xo - Round(FNeedleSettings.NeedleLength * cos((j + Position * FScaleSettings.Angle / FScaleSettings.Maximum) * Pi / 180));
+      Y := yo - Round(FNeedleSettings.NeedleLength * sin((j + Position * FScaleSettings.Angle / FScaleSettings.Maximum) * Pi / 180));
+
+      FGaugeNeedleBitmap.DrawLineAntialias(xo, yo, x, y,
+        FNeedleSettings.NeedleColor,
+        FScaleSettings.ThicknessMainTick);
+    end;
+    nsTriangle:
+    begin
+
+    end;
+  end;
+
+  // Draw cap over needle
+  FGaugeNeedleBitmap.EllipseAntialias(Xo, Yo, FNeedleSettings.CapRadius,
+    FNeedleSettings.CapRadius,
+    FNeedleSettings.CapEdgeColor,
+    2, FNeedleSettings.CapColor);
+
+end;
+
+procedure TDTCustomAnalogGauge.SetFaceSettings(AValue: TDTFaceSettings);
+begin
+  if FFaceSettings = AValue then
+    Exit;
+  FFaceSettings := AValue;
+
+  DoChange(self);
+
+end;
+
+procedure TDTCustomAnalogGauge.SetPosition(AValue: integer);
+begin
+  if FPosition = AValue then
+    Exit;
+  FPosition := AValue;
+
+  DoChange(self);
+
+end;
+
+procedure TDTCustomAnalogGauge.SetScaleSettings(AValue: TDTScaleSettings);
+begin
+  if FScaleSettings = AValue then
+    Exit;
+  FScaleSettings := AValue;
+
+  DoChange(self);
+
+end;
+
+procedure TDTCustomAnalogGauge.ResizeEvent(Sender: TObject);
+begin
+  FResized := True;
+end;
+
+procedure TDTCustomAnalogGauge.Paint;
+begin
+  inherited Paint;
+
+  ClearBitMap(FGaugeBitmap);
+
+  FGaugeBitmap.SetSize(Width, Height);
+
+  DrawGauge;
+
+  FGaugeBitmap.BlendImage(0, 0, FGaugeBodyBitmap, boLinearBlend);
+  FGaugeBitmap.BlendImage(0, 0, FGaugeScaleBitmap, boLinearBlend);
+  FGaugeBitmap.BlendImage(0, 0, FGaugeNeedleBitmap, boLinearBlend);
+
+  FGaugeBitmap.Draw(Canvas, 0, 0, False);
+
+end;
+
+end.

+ 16 - 8
dtthemedclock.pas

@@ -32,14 +32,20 @@
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit dtthemedclock;
 
-{$mode objfpc}{$H+}
+{$I bgracontrols.inc}
 
 interface
 
 uses
-  Classes, SysUtils, ExtCtrls, LResources, Forms, Controls, Graphics, Dialogs, DTAnalogCommon,
+  Classes, SysUtils, ExtCtrls, {$IFDEF FPC}LResources,{$ENDIF} Forms, Controls, Graphics, Dialogs, DTAnalogCommon,
+  {$IFNDEF FPC}Types, BGRAGraphics, GraphType, FPImage, {$ENDIF}
   BGRABitmap, BGRABitmapTypes;
 
 type
@@ -100,15 +106,17 @@ type
     property Enabled;
   end;
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
+{$IFDEF FPC}
 procedure Register;
 begin
   //{$I icons\dtthemedclock_icon.lrs}
   RegisterComponents('BGRA Controls', [TDTThemedClock]);
 end;
+{$ENDIF}
 
 { TDTCustomThemedClock }
 
@@ -179,14 +187,14 @@ begin
   inherited Create(AOwner);
 
   FSecondsPointerSettings := TDTPointerSettings.Create;
-  FSecondsPointerSettings.OnChange := @DoChange;
+  FSecondsPointerSettings.OnChange := DoChange;
   FMinutesPointerSettings := TDTPointerSettings.Create;
-  FMinutesPointerSettings.OnChange := @DoChange;
+  FMinutesPointerSettings.OnChange := DoChange;
   FHoursPointerSettings := TDTPointerSettings.Create;
-  FHoursPointerSettings.OnChange := @DoChange;
+  FHoursPointerSettings.OnChange := DoChange;
 
   FPointerCapSettings := TDTPointerCapSettings.Create;
-  FPointerCapSettings.OnChange := @DoChange;
+  FPointerCapSettings.OnChange := DoChange;
 
   FClockFace := TBGRABitmap.Create;
   FPointerBitmap := TBGRABitmap.Create;
@@ -206,7 +214,7 @@ begin
   FTimer := TTimer.Create(Self);
   FTimer.Interval := 1000;
   FTimer.Enabled := FEnabled;
-  FTimer.OnTimer := @TimerEvent;
+  FTimer.OnTimer := TimerEvent;
 
 end;
 

+ 280 - 0
dtthemedgauge.pas

@@ -0,0 +1,280 @@
+{
+  Part of BGRA Controls. Made by third party.
+  For detailed information see readme.txt
+
+  Site: https://sourceforge.net/p/bgra-controls/
+  Wiki: http://wiki.lazarus.freepascal.org/BGRAControls
+  Forum: http://forum.lazarus.freepascal.org/index.php/board,46.0.html
+
+  This library is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Library General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or (at your
+  option) any later version with the following modification:
+
+  As a special exception, the copyright holders of this library give you
+  permission to link this library with independent modules to produce an
+  executable, regardless of the license terms of these independent modules,and
+  to copy and distribute the resulting executable under terms of your choice,
+  provided that you also meet, for each linked independent module, the terms
+  and conditions of the license of that module. An independent module is a
+  module which is not derived from or based on this library. If you modify
+  this library, you may extend this exception to your version of the library,
+  but you are not obligated to do so. If you do not wish to do so, delete this
+  exception statement from your version.
+
+  This program is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
+  for more details.
+
+  You should have received a copy of the GNU Library General Public License
+  along with this library; if not, write to the Free Software Foundation,
+  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
+unit dtthemedgauge;
+
+{$I bgracontrols.inc}
+
+interface
+
+uses
+  Classes, SysUtils, Graphics, {$IFDEF FPC}LResources,{$ELSE} BGRAGraphics, {$ENDIF} Forms, Controls, Dialogs, DTAnalogCommon,
+  BGRABitmap, BGRABitmapTypes;
+
+type
+
+  { TDTCustomThemedGauge }
+
+  TDTCustomThemedGauge = class(TDTBaseAnalogDevice)
+  private
+    FPointerCapSettings: TDTPointerCapSettings;
+    FPointerSettings: TDTPointerSettings;
+    FScaleBitmap: TBGRABitmap;
+    FPointerBitmap: TBGRABitmap;
+    FPosition: integer;
+    procedure SetPointerCapSettings(AValue: TDTPointerCapSettings);
+    procedure SetPointerSettings(AValue: TDTPointerSettings);
+    procedure SetPosition(AValue: integer);
+    { Private declarations }
+  protected
+    { Protected declarations }
+    property PointerSettings: TDTPointerSettings read FPointerSettings write SetPointerSettings;
+    property PointerCapSettings: TDTPointerCapSettings read FPointerCapSettings write SetPointerCapSettings;
+    property Position: integer read FPosition write SetPosition;
+  public
+    { Public declarations }
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    procedure Paint; override;
+    procedure DrawScale;
+    procedure DrawPointer;
+  end;
+
+  { TDTThemedGauge }
+
+  TDTThemedGauge = class(TDTCustomThemedGauge)
+  private
+    { Private declarations }
+  protected
+    { Protected declarations }
+  public
+    { Public declarations }
+  published
+    { Published declarations }
+    property FaceSettings;
+    property ScaleSettings;
+    property PointerSettings;
+    property PointerCapSettings;
+    property Position;
+  end;
+
+{$IFDEF FPC}procedure Register;{$ENDIF}
+
+implementation
+
+{$IFDEF FPC}
+procedure Register;
+begin
+  //{$I icons\dtthemedgauge_icon.lrs}
+  RegisterComponents('BGRA Controls', [TDTThemedGauge]);
+end;
+{$ENDIF}
+
+{ TDTCustomThemedGauge }
+
+//procedure TDTCustomThemedGauge.SetNeedleSettings(AValue: TDTNeedleSettings);
+//begin
+//  if FNeedleSettings = AValue then
+//    Exit;
+//  FNeedleSettings := AValue;
+//
+//  DoChange(self);
+//end;
+//
+procedure TDTCustomThemedGauge.SetPointerCapSettings(AValue: TDTPointerCapSettings);
+begin
+  if FPointerCapSettings = AValue then
+    Exit;
+  FPointerCapSettings := AValue;
+
+  DoChange(self);
+end;
+
+procedure TDTCustomThemedGauge.SetPointerSettings(AValue: TDTPointerSettings);
+begin
+  if FPointerSettings = AValue then
+    Exit;
+  FPointerSettings := AValue;
+
+  DoChange(self);
+end;
+
+
+procedure TDTCustomThemedGauge.SetPosition(AValue: integer);
+begin
+  if FPosition = AValue then
+    Exit;
+  FPosition := AValue;
+
+  DoChange(self);
+end;
+
+constructor TDTCustomThemedGauge.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FPointerSettings := TDTPointerSettings.Create;
+  FPointerSettings.OnChange := DoChange;
+  FPointerSettings.Color := BGRA(255, 81, 81);
+
+  FPointerCapSettings := TDTPointerCapSettings.Create;
+  FPointerCapSettings.OnChange := DoChange;
+
+  FScaleBitmap := TBGRABitmap.Create;
+  FPointerBitmap := TBGRABitmap.Create;
+
+end;
+
+destructor TDTCustomThemedGauge.Destroy;
+begin
+  FPointerCapSettings.OnChange:=nil;
+  FPointerCapSettings.Free;
+  FPointerSettings.OnChange:=nil;
+  FPointerSettings.Free;
+
+  FScaleBitmap.Free;
+  FPointerBitmap.Free;
+  inherited Destroy;
+end;
+
+procedure TDTCustomThemedGauge.Paint;
+begin
+  inherited Paint;
+  DrawScale;
+  DrawPointer;
+
+  FGaugeBitmap.BlendImage(0, 0, FScaleBitmap, boLinearBlend);
+  FGaugeBitmap.BlendImage(0, 0, FPointerBitmap, boLinearBlend);
+
+  FGaugeBitmap.Draw(Canvas, 0, 0, False);
+
+end;
+
+procedure TDTCustomThemedGauge.DrawScale;
+var
+  Origin: TDTOrigin;
+  r, i, n, x, y, xt, yt: integer;
+  j: single;
+begin
+
+  Origin := Initializebitmap(FScaleBitmap, Width, Height);
+
+  r := round(Origin.Radius * 0.85);
+
+  //j := (180 - ScaleSettings.Angle) / 2;
+  j := (180 - 270) / 2;
+
+  // Draw SubTicks
+  if ScaleSettings.EnableSubTicks then
+  begin
+
+    n := ScaleSettings.MainTickCount * ScaleSettings.SubTickCount;
+
+    for i := 0 to n do
+    begin
+      // Calculate draw from point
+      X := Origin.CenterPoint.x - Round(r * cos((j + i * 270 / n) * Pi / 180));
+      Y := Origin.CenterPoint.y - Round(r * sin((j + i * 270 / n) * Pi / 180));
+
+      // Calculate draw to point
+      Xt := Origin.CenterPoint.x - Round((r - ScaleSettings.LengthSubTick) * cos((j + i * 270 / n) * Pi / 180));
+      Yt := Origin.CenterPoint.y - Round((r - ScaleSettings.LengthSubTick) * sin((j + i * 270 / n) * Pi / 180));
+
+      FScaleBitmap.DrawLineAntialias(x, y, xt, yt, ScaleSettings.TickColor, ScaleSettings.ThicknessSubTick);
+
+    end;
+  end;
+
+  if ScaleSettings.EnableMainTicks then
+  begin
+
+    FScaleBitmap.FontName := ScaleSettings.TextFont;
+    FScaleBitmap.FontHeight := ScaleSettings.TextSize;
+    FScaleBitmap.FontQuality := fqFineAntialiasing;
+
+    n := ScaleSettings.MainTickCount;
+
+    for i := 0 to n do
+    begin
+      // Draw main ticks
+      // Calculate draw from point
+      X := Origin.CenterPoint.x - Round(r * cos((j + i * 270 / n) * Pi / 180));
+      Y := Origin.CenterPoint.y - Round(r * sin((j + i * 270 / n) * Pi / 180));
+
+      // Calculate draw to point
+      Xt := Origin.CenterPoint.x - Round((r - ScaleSettings.LengthMainTick) * cos((j + i * 270 / n) * Pi / 180));
+      Yt := Origin.CenterPoint.y - Round((r - ScaleSettings.LengthMainTick) * sin((j + i * 270 / n) * Pi / 180));
+
+      FScaleBitmap.DrawLineAntialias(x, y, xt, yt, ScaleSettings.TickColor, ScaleSettings.ThicknessMainTick);
+
+      if ScaleSettings.EnableScaleText then
+      begin
+        // Draw text for main ticks
+        Xt := Origin.CenterPoint.x - Round(ScaleSettings.TextRadius * cos((j + i * 270 / n) * Pi / 180));
+        Yt := Origin.CenterPoint.y - Round(ScaleSettings.TextRadius * sin((j + i * 270 / n) * Pi / 180));
+
+        FScaleBitmap.TextOut(Xt, Yt - (FScaleBitmap.FontHeight / 1.7), IntToStr(i * ScaleSettings.Maximum div ScaleSettings.MainTickCount), ScaleSettings.TextColor, taCenter);
+      end;
+    end;
+  end;
+end;
+
+procedure TDTCustomThemedGauge.DrawPointer;
+var
+  Origin: TDTOrigin;
+  {%H-}r, x, y: integer;
+  j: single;
+begin
+
+  Origin := Initializebitmap(FPointerBitmap, Width, Height);
+
+  r := round(Origin.Radius * 0.85);
+
+  j := (180 - 270) / 2;
+
+  X := origin.CenterPoint.x - Round(PointerSettings.Length * cos((j + Position * 270 / ScaleSettings.Maximum) * Pi / 180));
+  Y := origin.CenterPoint.y - Round(PointerSettings.Length * sin((j + Position * 270 / ScaleSettings.Maximum) * Pi / 180));
+
+  FPointerBitmap.DrawLineAntialias(origin.CenterPoint.y, origin.CenterPoint.y, x, y, PointerSettings.Color, PointerSettings.Thickness);
+
+  // Draw cap over needle
+  FPointerBitmap.EllipseAntialias(origin.CenterPoint.x, origin.CenterPoint.y, PointerCapSettings.Radius, PointerCapSettings.Radius, PointerCapSettings.EdgeColor, 2, ColorToBGRA(PointerCapSettings.FillColor));
+end;
+
+end.

+ 91 - 0
lcl/KeyInputIntf.pas

@@ -0,0 +1,91 @@
+{ KeyInputIntf
+
+  Copyright (C) 2008 Tom Gregorovic
+
+  This source is free software; you can redistribute it and/or modify it under the terms of the
+  GNU General Public License as published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  A copy of the GNU General Public License is available on the World Wide Web at
+  <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+unit KeyInputIntf;
+
+
+interface
+
+uses
+  Classes, SysUtils, Types, windows, messages, Forms;
+
+type
+  { TKeyInput }
+
+  TKeyInput = class
+  protected
+    procedure DoDown(Key: Word); dynamic; abstract;
+    procedure DoUp(Key: Word); dynamic; abstract;
+  public
+    procedure Down(Key: Word);
+    procedure Up(Key: Word);
+
+    procedure Press(Key: Word);  overload;
+    procedure Press(StringValue : String);  overload;
+
+    procedure Apply(Shift: TShiftState);
+    procedure Unapply(Shift: TShiftState);
+  end;
+
+implementation
+
+{ TKeyInput }
+
+procedure TKeyInput.Down(Key: Word);
+begin  DoDown(Key);
+  Application.ProcessMessages;
+end;
+
+procedure TKeyInput.Up(Key: Word);
+begin
+  DoUp(Key);
+  Application.ProcessMessages;
+end;
+
+procedure TKeyInput.Press(Key: Word);
+begin
+  Down(Key);
+  Up(Key);
+end;
+
+procedure TKeyInput.Press(StringValue: String);
+var
+  i : Integer;
+begin
+  i :=1;
+  while (i <= Length(StringValue)) do
+    begin
+      Press(Ord(StringValue[i]));
+      Inc(i);
+    end;
+end;
+
+procedure TKeyInput.Apply(Shift: TShiftState);
+begin
+  if ssCtrl in Shift then Down(VK_CONTROL);
+  if ssAlt in Shift then Down(VK_MENU);
+  if ssShift in Shift then Down(VK_SHIFT);
+end;
+
+procedure TKeyInput.Unapply(Shift: TShiftState);
+begin
+  if ssShift in Shift then Up(VK_SHIFT);
+  if ssCtrl in Shift then Up(VK_CONTROL);
+  if ssAlt in Shift then Up(VK_MENU);
+end;
+
+end.
+

+ 50 - 0
lcl/MouseAndKeyInput.pas

@@ -0,0 +1,50 @@
+{ MouseAndKeyInput
+
+  Copyright (C) 2008 Tom Gregorovic
+
+  This source is free software; you can redistribute it and/or modify it under the terms of the
+  GNU General Public License as published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  A copy of the GNU General Public License is available on the World Wide Web at
+  <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+unit MouseAndKeyInput;
+
+interface
+
+uses
+  MouseInputIntf,
+  KeyInputIntf,
+  WinMouseInput,
+  WinKeyInput,
+  Classes, SysUtils;
+
+var
+  MouseInput: TMouseInput;
+  KeyInput: TKeyInput;
+
+implementation
+
+
+
+initialization
+
+  // Create platform specific object for mouse input
+  MouseInput := InitializeMouseInput;
+
+  // Create platform specific object for key input
+  KeyInput := InitializeKeyInput;
+
+finalization
+
+  FreeAndNil(MouseInput);
+  FreeAndNil(KeyInput);
+
+
+end.

+ 283 - 0
lcl/MouseInputIntf.pas

@@ -0,0 +1,283 @@
+{ MouseInputIntf
+
+  Copyright (C) 2008 Tom Gregorovic
+
+  This source is free software; you can redistribute it and/or modify it under the terms of the
+  GNU General Public License as published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  A copy of the GNU General Public License is available on the World Wide Web at
+  <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+unit MouseInputIntf;
+
+interface
+
+uses
+  Classes, SysUtils, Types, windows, Controls, Forms;
+
+type
+  { TMouseInput }
+
+  TMouseInput = class
+  protected
+    procedure DoDown(Button: TMouseButton); dynamic; abstract;
+    procedure DoMove(ScreenX, ScreenY: Integer); dynamic; abstract;
+    procedure DoUp(Button: TMouseButton); dynamic; abstract;
+    procedure DoScrollUp; dynamic; abstract;
+    procedure DoScrollDown; dynamic; abstract;
+  public
+    procedure Down(Button: TMouseButton; Shift: TShiftState); overload;
+    procedure Down(Button: TMouseButton; Shift: TShiftState; Control: TControl; X, Y: Integer); overload;
+    procedure Down(Button: TMouseButton; Shift: TShiftState; ScreenX, ScreenY: Integer); overload;
+
+    procedure Move(Shift: TShiftState; Control: TControl; X, Y: Integer; Duration: Integer = 0); overload;
+    procedure MoveBy(Shift: TShiftState; DX, DY: Integer; Duration: Integer = 0); overload;
+    procedure Move(Shift: TShiftState; ScreenX, ScreenY: Integer; Duration: Integer); overload;
+    procedure Move(Shift: TShiftState; ScreenX, ScreenY: Integer); overload;
+
+    procedure ScrollUp(Shift: TShiftState); overload;
+    procedure ScrollUp(Shift: TShiftState; Control: TControl; X, Y: Integer); overload;
+    procedure ScrollUp(Shift: TShiftState; ScreenX, ScreenY: Integer); overload;
+    procedure ScrollDown(Shift: TShiftState); overload;
+    procedure ScrollDown(Shift: TShiftState; Control: TControl; X, Y: Integer); overload;
+    procedure ScrollDown(Shift: TShiftState; ScreenX, ScreenY: Integer); overload;
+
+    procedure Up(Button: TMouseButton; Shift: TShiftState); overload;
+    procedure Up(Button: TMouseButton; Shift: TShiftState; Control: TControl; X, Y: Integer); overload;
+    procedure Up(Button: TMouseButton; Shift: TShiftState; ScreenX, ScreenY: Integer); overload;
+
+    procedure Click(Button: TMouseButton; Shift: TShiftState); overload;
+    procedure Click(Button: TMouseButton; Shift: TShiftState; Control: TControl; X, Y: Integer); overload;
+    procedure Click(Button: TMouseButton; Shift: TShiftState; ScreenX, ScreenY: Integer); overload;
+
+    procedure DblClick(Button: TMouseButton; Shift: TShiftState); overload;
+    procedure DblClick(Button: TMouseButton; Shift: TShiftState; Control: TControl; X, Y: Integer); overload;
+    procedure DblClick(Button: TMouseButton; Shift: TShiftState; ScreenX, ScreenY: Integer); overload;
+  end;
+
+implementation
+
+uses
+  Math, MouseAndKeyInput;
+
+{ TMouseInput }
+
+procedure TMouseInput.Down(Button: TMouseButton; Shift: TShiftState);
+begin
+  KeyInput.Apply(Shift);
+  try
+    DoDown(Button);
+  finally
+    KeyInput.Unapply(Shift);
+  end;
+  Application.ProcessMessages;
+end;
+
+procedure TMouseInput.Down(Button: TMouseButton; Shift: TShiftState;
+  Control: TControl; X, Y: Integer);
+var
+  P: TPoint;
+begin
+  P := Control.ClientToScreen(Point(X, Y));
+  Down(Button, Shift, P.X, P.Y);
+end;
+
+procedure TMouseInput.Down(Button: TMouseButton; Shift: TShiftState;
+  ScreenX, ScreenY: Integer);
+begin
+  KeyInput.Apply(Shift);
+  try
+    DoMove(ScreenX, ScreenY);
+    DoDown(Button);
+  finally
+    KeyInput.Unapply(Shift);
+  end;
+end;
+
+procedure TMouseInput.Move(Shift: TShiftState; Control: TControl; X, Y: Integer; Duration: Integer = 0);
+var
+  P: TPoint;
+begin
+  P := Control.ClientToScreen(Point(X, Y));
+  Move(Shift, P.X, P.Y, Duration);
+end;
+
+procedure TMouseInput.MoveBy(Shift: TShiftState; DX, DY: Integer; Duration: Integer = 0);
+var
+  P: TPoint;
+begin
+  P := Mouse.CursorPos;
+  Move(Shift, P.X + DX, P.Y + DY, Duration);
+end;
+
+procedure TMouseInput.Move(Shift: TShiftState; ScreenX, ScreenY: Integer; Duration: Integer);
+const
+  Interval = 20; //ms
+var
+  TimeStep: Integer;
+  X, Y: Integer;
+  Start: TPoint;
+  S: LongWord;
+begin
+  Start := Mouse.CursorPos;
+
+  while Duration > 0 do
+  begin
+    TimeStep := Min(Interval, Duration);
+
+    S := {%H-}Windows.GetTickCount;
+    while {%H-}Windows.GetTickCount - S < TimeStep do Application.ProcessMessages;
+
+    X := Start.X + ((ScreenX - Start.X) * TimeStep) div Duration;
+    Y := Start.Y + ((ScreenY - Start.Y) * TimeStep) div Duration;
+    Move(Shift, X, Y);
+
+    Duration := Duration - TimeStep;
+    Start := Point(X, Y);
+  end;
+
+  Move(Shift, ScreenX, ScreenY);
+end;
+
+procedure TMouseInput.Move(Shift: TShiftState; ScreenX, ScreenY: Integer);
+begin
+  KeyInput.Apply(Shift);
+  try
+    DoMove(ScreenX, ScreenY);
+  finally
+    KeyInput.Unapply(Shift);
+  end;
+  Application.ProcessMessages;
+end;
+
+procedure TMouseInput.ScrollUp(Shift: TShiftState);
+begin
+  KeyInput.Apply(Shift);
+  try
+    DoScrollUp;
+  finally
+    KeyInput.Unapply(Shift);
+  end;
+  Application.ProcessMessages;
+end;
+
+procedure TMouseInput.ScrollUp(Shift: TShiftState; Control: TControl;
+  X, Y: Integer);
+var
+  P: TPoint;
+begin
+  P := Control.ClientToScreen(Point(X, Y));
+  ScrollUp(Shift, P.X, P.Y);
+end;
+
+procedure TMouseInput.ScrollUp(Shift: TShiftState; ScreenX, ScreenY: Integer);
+begin
+  Move(Shift, ScreenX, ScreenY);
+  ScrollUp(Shift);
+end;
+
+procedure TMouseInput.ScrollDown(Shift: TShiftState);
+begin
+  KeyInput.Apply(Shift);
+  try
+    DoScrollDown;
+  finally
+    KeyInput.Unapply(Shift);
+  end;
+  Application.ProcessMessages;
+end;
+
+procedure TMouseInput.ScrollDown(Shift: TShiftState; Control: TControl;
+  X, Y: Integer);
+var
+  P: TPoint;
+begin
+  P := Control.ClientToScreen(Point(X, Y));
+  ScrollDown(Shift, P.X, P.Y);
+end;
+
+procedure TMouseInput.ScrollDown(Shift: TShiftState; ScreenX, ScreenY: Integer);
+begin
+  Move(Shift, ScreenX, ScreenY);
+  ScrollDown(Shift);
+end;
+
+procedure TMouseInput.Up(Button: TMouseButton; Shift: TShiftState);
+begin
+  KeyInput.Apply(Shift);
+  try
+    DoUp(Button);
+  finally
+    KeyInput.Unapply(Shift);
+  end;
+  Application.ProcessMessages;
+end;
+
+procedure TMouseInput.Up(Button: TMouseButton; Shift: TShiftState;
+  Control: TControl; X, Y: Integer);
+var
+  P: TPoint;
+begin
+  P := Control.ClientToScreen(Point(X, Y));
+  Up(Button, Shift, P.X, P.Y);
+end;
+
+procedure TMouseInput.Up(Button: TMouseButton; Shift: TShiftState;
+  ScreenX, ScreenY: Integer);
+begin
+  Move(Shift, ScreenX, ScreenY);
+  Up(Button, Shift);
+end;
+
+procedure TMouseInput.Click(Button: TMouseButton; Shift: TShiftState);
+begin
+  Down(Button, Shift);
+  Up(Button, Shift);
+end;
+
+procedure TMouseInput.Click(Button: TMouseButton; Shift: TShiftState;
+  Control: TControl; X, Y: Integer);
+var
+  P: TPoint;
+begin
+  P := Control.ClientToScreen(Point(X, Y));
+  Click(Button, Shift, P.X, P.Y);
+end;
+
+procedure TMouseInput.Click(Button: TMouseButton; Shift: TShiftState;
+  ScreenX, ScreenY: Integer);
+begin
+  Move(Shift, ScreenX, ScreenY);
+  Click(Button, Shift);
+end;
+
+procedure TMouseInput.DblClick(Button: TMouseButton; Shift: TShiftState);
+begin
+  Click(Button, Shift);
+  Click(Button, Shift);
+end;
+
+procedure TMouseInput.DblClick(Button: TMouseButton; Shift: TShiftState;
+  Control: TControl; X, Y: Integer);
+var
+  P: TPoint;
+begin
+  P := Control.ClientToScreen(Point(X, Y));
+  DblClick(Button, Shift, P.X, P.Y);
+end;
+
+procedure TMouseInput.DblClick(Button: TMouseButton; Shift: TShiftState;
+  ScreenX, ScreenY: Integer);
+begin
+  Move(Shift, ScreenX, ScreenY);
+  DblClick(Button, Shift);
+end;
+
+end.
+

+ 71 - 0
lcl/WinKeyInput.pas

@@ -0,0 +1,71 @@
+{ WinKeyInput
+
+  Copyright (C) 2008 Tom Gregorovic
+
+  This source is free software; you can redistribute it and/or modify it under the terms of the
+  GNU General Public License as published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  A copy of the GNU General Public License is available on the World Wide Web at
+  <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+unit WinKeyInput;
+
+interface
+
+uses
+  Classes, SysUtils, Controls, Forms,
+  Windows, //JwaWinUser,
+  KeyInputIntf;
+
+type
+
+  { TWinKeyInput }
+
+  TWinKeyInput = class(TKeyInput)
+  protected
+    procedure DoDown(Key: Word); override;
+    procedure DoUp(Key: Word); override;
+  end;
+
+function InitializeKeyInput: TKeyInput;
+
+implementation
+
+function InitializeKeyInput: TKeyInput;
+begin
+  Result := TWinKeyInput.Create;
+end;
+
+procedure SendKeyInput(Flag: DWORD; Key: Word);
+var
+  Input: TInput;
+begin
+  FillChar({%H-}Input, SizeOf(Input), 0);
+  Input.Itype := INPUT_KEYBOARD;
+  Input.ki.dwFlags := Flag;
+  Input.ki.wVk := Key;
+
+  SendInput(1, Input, SizeOf(Input));
+end;
+
+
+{ TWinKeyInput }
+
+procedure TWinKeyInput.DoDown(Key: Word);
+begin
+  SendKeyInput(0, Key);
+end;
+
+procedure TWinKeyInput.DoUp(Key: Word);
+begin
+  SendKeyInput(KEYEVENTF_KEYUP, Key);
+end;
+
+end.
+

+ 126 - 0
lcl/WinMouseInput.pas

@@ -0,0 +1,126 @@
+{ WinMouseInput
+
+  Copyright (C) 2008 Tom Gregorovic
+
+  This source is free software; you can redistribute it and/or modify it under the terms of the
+  GNU General Public License as published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  A copy of the GNU General Public License is available on the World Wide Web at
+  <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+unit WinMouseInput;
+
+
+interface
+
+uses
+  Classes, SysUtils, Controls, Forms,
+  Windows, //JwaWinUser,
+  MouseInputIntf;
+
+type
+
+  { TWinMouseInput }
+
+  TWinMouseInput = class(TMouseInput)
+  protected
+    procedure DoDown(Button: TMouseButton); override;
+    procedure DoMove(ScreenX, ScreenY: Integer); override;
+    procedure DoUp(Button: TMouseButton); override;
+    procedure DoScrollUp; override;
+    procedure DoScrollDown; override;
+  end;
+
+function InitializeMouseInput: TMouseInput;
+
+implementation
+
+function InitializeMouseInput: TMouseInput;
+begin
+  Result := TWinMouseInput.Create;
+end;
+
+procedure SendMouseInput(Flag: DWORD; MouseData: DWORD = 0); overload;
+var
+  Input: TInput;
+begin
+{$IFDEF VER2_6}
+  FillChar(Input, SizeOf(Input), 0);
+{$ELSE}
+  Input := Default(TInput);
+{$ENDIF}
+  Input.mi.mouseData := MouseData;
+  Input.Itype := INPUT_MOUSE;
+  Input.mi.dwFlags := Flag;
+
+  SendInput(1, Input, SizeOf(Input));
+end;
+
+procedure SendMouseInput(Flag: DWORD; X, Y: Integer); overload;
+var
+  Input: TInput;
+begin
+{$IFDEF VER2_6}
+  FillChar(Input, SizeOf(Input), 0);
+{$ELSE}
+  Input := Default(TInput);
+{$ENDIF}
+  Input.Itype := INPUT_MOUSE;
+  Input.mi.dx := MulDiv(X, 65535, Screen.Width - 1); // screen horizontal coordinates: 0 - 65535
+  Input.mi.dy := MulDiv(Y, 65535, Screen.Height - 1); // screen vertical coordinates: 0 - 65535
+  Input.mi.dwFlags := Flag or MOUSEEVENTF_ABSOLUTE;
+
+  SendInput(1, Input, SizeOf(Input));
+end;
+
+{ TWinMouseInput }
+
+procedure TWinMouseInput.DoDown(Button: TMouseButton);
+var
+  Flag: DWORD;
+begin
+  case Button of
+    mbRight: Flag := MOUSEEVENTF_RIGHTDOWN;
+    mbMiddle: Flag := MOUSEEVENTF_MIDDLEDOWN;
+  else
+    Flag := MOUSEEVENTF_LEFTDOWN;
+  end;
+  SendMouseInput(Flag);
+end;
+
+procedure TWinMouseInput.DoMove(ScreenX, ScreenY: Integer);
+begin
+  SendMouseInput(MOUSEEVENTF_MOVE, ScreenX, ScreenY);
+end;
+
+procedure TWinMouseInput.DoUp(Button: TMouseButton);
+var
+  Flag: DWORD;
+begin
+  case Button of
+    mbRight: Flag := MOUSEEVENTF_RIGHTUP;
+    mbMiddle: Flag := MOUSEEVENTF_MIDDLEUP;
+  else
+    Flag := MOUSEEVENTF_LEFTUP;
+  end;
+  SendMouseInput(Flag);
+end;
+
+procedure TWinMouseInput.DoScrollUp;
+begin
+  SendMouseInput(MOUSEEVENTF_WHEEL, WHEEL_DELTA);
+end;
+
+procedure TWinMouseInput.DoScrollDown;
+begin
+  SendMouseInput(MOUSEEVENTF_WHEEL, DWORD(-WHEEL_DELTA));
+end;
+
+end.
+

+ 12 - 3
materialcolors.pas

@@ -3,14 +3,23 @@
   https://material.google.com/style/color.html#color-color-palette
 }
 
+{******************************* CONTRIBUTOR(S) ******************************
+- Edivando S. Santos Brasil | [email protected]
+  (Compatibility with delphi VCL 11/2018)
+
+***************************** END CONTRIBUTOR(S) *****************************}
 unit MaterialColors;
 
-{$mode objfpc}{$H+}{$MODESWITCH ADVANCEDRECORDS}
+{$I bgracontrols.inc}
+
+{$IFDEF FPC}
+  {$MODESWITCH ADVANCEDRECORDS}
+{$ENDIF}
 
 interface
 
 uses
-  Classes, SysUtils, BGRABitmap, BGRABitmapTypes, FGL;
+  Classes, SysUtils, BGRABitmap, BGRABitmapTypes, Generics.Collections;
 
 type
 
@@ -35,7 +44,7 @@ type
         aM700, aM800, aM900, aA100, aA200, aA400, aA700: string);
   end;
 
-  TMaterialColorsList = specialize TFPGMap<string, TMaterialColors>;
+  TMaterialColorsList = {specialize} TDictionary<string, TMaterialColors>;
 
 procedure MaterialColorsListStr(AList: TStrings);
 

+ 2 - 2
update_bgracontrols_force.json

@@ -6,9 +6,9 @@
   "UpdatePackageFiles" : [
     {
       "ForceNotify" : true,
-      "InternalVersion" : 18,
+      "InternalVersion" : 16,
       "Name" : "bgracontrols.lpk",
-      "Version" : "5.0.3.0"
+      "Version" : "5.0.1.0"
     },
     {
       "ForceNotify" : false,

+ 3 - 2
upsi_bgrapascalscript.pas

@@ -67,7 +67,7 @@ procedure SIRegister_bgrapascalscript(CL: TPSPascalCompiler);
 { run-time registration functions }
 procedure RIRegister_bgrapascalscript_Routines(S: TPSExec);
 
-procedure Register;
+{$IFDEF FPC}procedure Register;{$ENDIF}
 
 implementation
 
@@ -79,11 +79,12 @@ uses
   ,Dialogs;
  
  
+{$IFDEF FPC}
 procedure Register;
 begin
   RegisterComponents('BGRA Controls', [TPSImport_bgrapascalscript]);
 end;
-
+{$ENDIF}
 (* === compile-time registration functions === *)
 (*----------------------------------------------------------------------------*)
 procedure SIRegister_BGRAPascalScript(CL: TPSPascalCompiler);

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.