LCL: broke unit dependency of graphics on controls

git-svn-id: trunk@31628 -
This commit is contained in:
mattias 2011-07-09 23:10:27 +00:00
parent c36216f022
commit 597e60e8a7
4 changed files with 28 additions and 11 deletions

View File

@ -41,7 +41,8 @@ uses
Classes, SysUtils, Types, TypInfo, Math, Classes, SysUtils, Types, TypInfo, Math,
AvgLvlTree, Maps, LCLVersion, LCLStrConsts, LCLType, LCLProc, LCLIntf, AvgLvlTree, Maps, LCLVersion, LCLStrConsts, LCLType, LCLProc, LCLIntf,
FileUtil, InterfaceBase, LResources, GraphType, Graphics, Menus, LMessages, FileUtil, InterfaceBase, LResources, GraphType, Graphics, Menus, LMessages,
CustomTimer, ActnList, ClipBrd, CustApp, HelpIntfs, LCLClasses, Controls, Themes CustomTimer, ActnList, ClipBrd, CustApp, HelpIntfs, LCLClasses, Controls,
ImgList, Themes
{$ifndef wince},gettext{$endif}// remove ifdefs when gettext is fixed and a new fpc is released {$ifndef wince},gettext{$endif}// remove ifdefs when gettext is fixed and a new fpc is released
; ;
@ -1980,6 +1981,15 @@ end;
//============================================================================== //==============================================================================
procedure ImageDrawEvent(AImageList: TPersistent; ACanvas: TPersistent;
AX, AY, AIndex: Integer; ADrawEffect: TGraphicsDrawEffect);
var
ImageList: TCustomImageList absolute AImageList;
Canvas: TCanvas absolute ACanvas;
begin
ImageList.Draw(Canvas,AX,AY,AIndex,ADrawEffect);
end;
initialization initialization
{$INCLUDE cursors.lrs} {$INCLUDE cursors.lrs}
RegisterPropertyToSkip(TForm, 'OldCreateOrder', 'VCL compatibility property', ''); RegisterPropertyToSkip(TForm, 'OldCreateOrder', 'VCL compatibility property', '');
@ -1987,6 +1997,7 @@ initialization
RegisterPropertyToSkip(TForm, 'Scaled', 'VCL compatibility property', ''); RegisterPropertyToSkip(TForm, 'Scaled', 'VCL compatibility property', '');
RegisterPropertyToSkip(TForm, 'TransparentColorValue', 'VCL compatibility property', ''); RegisterPropertyToSkip(TForm, 'TransparentColorValue', 'VCL compatibility property', '');
LCLProc.OwnerFormDesignerModifiedProc:=@IfOwnerIsFormThenDesignerModified; LCLProc.OwnerFormDesignerModifiedProc:=@IfOwnerIsFormThenDesignerModified;
ThemesImageDrawEvent:=@ImageDrawEvent;
Screen:=TScreen.Create(nil); Screen:=TScreen.Create(nil);
Application:=TApplication.Create(nil); Application:=TApplication.Create(nil);

View File

@ -44,8 +44,8 @@ uses
FPReadGif, FPReadGif,
IntfGraphics, IntfGraphics,
AvgLvlTree, AvgLvlTree,
LCLStrConsts, LCLType, LCLProc, LMessages, LCLIntf, LResources, LCLResCache, LCLStrConsts, LCLType, LCLProc, LMessages, LResources, LCLResCache,
GraphType, IcnsTypes, GraphMath, InterfaceBase, WSReferences; GraphType, IcnsTypes, GraphMath, WSReferences;
type type
PColor = ^TColor; PColor = ^TColor;
@ -2017,8 +2017,9 @@ procedure Register;
procedure UpdateHandleObjects; procedure UpdateHandleObjects;
implementation implementation
uses uses
SyncObjs; SyncObjs, LCLIntf, InterfaceBase;
var var
GraphicsUpdateCount: Integer = 0; GraphicsUpdateCount: Integer = 0;

View File

@ -33,7 +33,7 @@ interface
uses uses
Classes, SysUtils, fpImage, FPReadBMP, FPWriteBMP, BMPComn, FPCAdds, Classes, SysUtils, fpImage, FPReadBMP, FPWriteBMP, BMPComn, FPCAdds,
AvgLvlTree, LCLType, LCLversion, Math, AvgLvlTree, LCLType, LCLversion, Math,
LCLProc, GraphType, LCLIntf, FPReadPNG, FPWritePNG, FPReadTiff, FPWriteTiff, LCLProc, GraphType, FPReadPNG, FPWritePNG, FPReadTiff, FPWriteTiff,
IcnsTypes; IcnsTypes;
type type
@ -731,7 +731,7 @@ function dbgs(const FPColor: TFPColor): string; overload;
implementation implementation
uses uses
Graphics; Graphics, LCLIntf;
type type
PFPColorBytes = ^TFPColorBytes; PFPColorBytes = ^TFPColorBytes;

View File

@ -48,7 +48,8 @@ interface
uses uses
// no Graphics or Controls can be used here to prevent circular references // no Graphics or Controls can be used here to prevent circular references
// //
Types, Math, Classes, LCLProc, LCLType, TmSchema; SysUtils, Types, GraphType, Math, Classes, LCLProc, LCLType, Graphics,
TmSchema;
type type
// These are all elements which can be themed. // These are all elements which can be themed.
@ -510,11 +511,16 @@ const
// Do not modify the copyright in any way! Usage of this unit is prohibited without the copyright notice // Do not modify the copyright in any way! Usage of this unit is prohibited without the copyright notice
// in the compiled binary file. // in the compiled binary file.
ThemeManagerCopyright: string = 'Theme manager © 2001-2005 Mike Lischke'; ThemeManagerCopyright: string = 'Theme manager © 2001-2005 Mike Lischke';
type
TThemesImageDrawEvent = procedure(AImageList: TPersistent; ACanvas: TPersistent;
AX, AY, AIndex: Integer; ADrawEffect: TGraphicsDrawEffect);
var
ThemesImageDrawEvent: TThemesImageDrawEvent = nil; // set by unit ImgList if used
implementation implementation
uses uses
SysUtils, InterfaceBase, LCLIntf, GraphType, Graphics, ImgList; InterfaceBase, LCLIntf;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -2187,10 +2193,9 @@ procedure TThemeServices.DrawIcon(ACanvas: TPersistent;
Details: TThemedElementDetails; const P: TPoint; AImageList: TPersistent; Details: TThemedElementDetails; const P: TPoint; AImageList: TPersistent;
Index: Integer); Index: Integer);
var var
Canvas: TCanvas absolute ACanvas;
ImageList: TCustomImageList absolute AImageList;
AEffect: TGraphicsDrawEffect; AEffect: TGraphicsDrawEffect;
begin begin
if not Assigned(ThemesImageDrawEvent) then exit;
if IsDisabled(Details) then if IsDisabled(Details) then
AEffect := gdeDisabled AEffect := gdeDisabled
else else
@ -2201,7 +2206,7 @@ begin
AEffect := gdeHighlighted AEffect := gdeHighlighted
else else
AEffect := gdeNormal; AEffect := gdeNormal;
ImageList.Draw(Canvas, P.X, P.Y, Index, AEffect); ThemesImageDrawEvent(AImageList, ACanvas, P.X, P.Y, Index, AEffect);
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------