mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:59:08 +02:00
parent
36d2265441
commit
4d72cd427e
@ -42,11 +42,7 @@ unit SynEditMiscClasses;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf, LCLType, LCLProc,
|
LCLIntf, LCLType, LCLProc,
|
||||||
{$ELSE}
|
|
||||||
Windows,
|
|
||||||
{$ENDIF}
|
|
||||||
Classes, Graphics, Controls, SysUtils, Clipbrd,
|
Classes, Graphics, Controls, SysUtils, Clipbrd,
|
||||||
SynEditMiscProcs, SynEditTypes, SynEditTextBase, SynEditPointClasses;
|
SynEditMiscProcs, SynEditTypes, SynEditTextBase, SynEditPointClasses;
|
||||||
|
|
||||||
@ -310,10 +306,6 @@ type
|
|||||||
constructor Create(const AName: string; Count: integer);
|
constructor Create(const AName: string; Count: integer);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure DrawMark(ACanvas: TCanvas; Number, X, Y, LineHeight: integer);
|
procedure DrawMark(ACanvas: TCanvas; Number, X, Y, LineHeight: integer);
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
procedure DrawMarkTransparent(ACanvas: TCanvas; Number, X, Y,
|
|
||||||
LineHeight: integer; TransparentColor: TColor);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -954,28 +946,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
procedure TSynInternalImage.DrawMarkTransparent(ACanvas: TCanvas; Number, X, Y,
|
|
||||||
LineHeight: integer; TransparentColor: TColor);
|
|
||||||
var
|
|
||||||
rcSrc, rcDest: TRect;
|
|
||||||
begin
|
|
||||||
if (Number >= 0) and (Number < IICount) then
|
|
||||||
begin
|
|
||||||
if LineHeight >= IIHeight then begin
|
|
||||||
rcSrc := Rect(Number * IIWidth, 0, (Number + 1) * IIWidth, IIHeight);
|
|
||||||
Inc(Y, (LineHeight - IIHeight) div 2);
|
|
||||||
rcDest := Rect(X, Y, X + IIWidth, Y + IIHeight);
|
|
||||||
end else begin
|
|
||||||
rcDest := Rect(X, Y, X + IIWidth, Y + LineHeight);
|
|
||||||
Y := (IIHeight - LineHeight) div 2;
|
|
||||||
rcSrc := Rect(Number * IIWidth, Y, (Number + 1) * IIWidth, Y + LineHeight);
|
|
||||||
end;
|
|
||||||
ACanvas.BrushCopy(rcDest, InternalImages, rcSrc, TransparentColor);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{ TSynObjectList }
|
{ TSynObjectList }
|
||||||
|
|
||||||
constructor TSynObjectList.Create(AOwner: TComponent);
|
constructor TSynObjectList.Create(AOwner: TComponent);
|
||||||
|
@ -62,19 +62,12 @@
|
|||||||
|
|
||||||
unit SynTextDrawer;
|
unit SynTextDrawer;
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$mode objfpc}{$H+}
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
{$DEFINE SYN_LAZARUS}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLProc, LCLType, LCLIntf, GraphType,
|
LCLProc, LCLType, LCLIntf, GraphType,
|
||||||
{$ELSE}
|
|
||||||
Windows,
|
|
||||||
{$ENDIF}
|
|
||||||
SysUtils, Classes, Graphics, GraphUtil, Types, SynEditTypes, SynEditMiscProcs;
|
SysUtils, Classes, Graphics, GraphUtil, Types, SynEditTypes, SynEditMiscProcs;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -119,8 +112,7 @@ type
|
|||||||
procedure LockFontsInfo(pFontsInfo: PheSharedFontsInfo);
|
procedure LockFontsInfo(pFontsInfo: PheSharedFontsInfo);
|
||||||
procedure UnLockFontsInfo(pFontsInfo: PheSharedFontsInfo);
|
procedure UnLockFontsInfo(pFontsInfo: PheSharedFontsInfo);
|
||||||
function GetFontsInfo(ABaseFont: TFont): PheSharedFontsInfo;
|
function GetFontsInfo(ABaseFont: TFont): PheSharedFontsInfo;
|
||||||
procedure ReleaseFontsInfo(
|
procedure ReleaseFontsInfo(var pFontsInfo: PheSharedFontsInfo);
|
||||||
{$IFDEF SYN_LAZARUS}var {$ENDIF}pFontsInfo: PheSharedFontsInfo);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TheFontStock }
|
{ TheFontStock }
|
||||||
@ -188,9 +180,7 @@ type
|
|||||||
private
|
private
|
||||||
FDC: HDC;
|
FDC: HDC;
|
||||||
FSaveDC: Integer;
|
FSaveDC: Integer;
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
FSavedFont: HFont;
|
FSavedFont: HFont;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
// Font information
|
// Font information
|
||||||
FFontStock: TheFontStock;
|
FFontStock: TheFontStock;
|
||||||
@ -219,13 +209,8 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure ReleaseETODist; virtual;
|
procedure ReleaseETODist; virtual;
|
||||||
procedure AfterStyleSet; virtual;
|
procedure AfterStyleSet; virtual;
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
procedure DoSetCharExtra(Value: Integer); virtual;
|
|
||||||
{$ENDIF}
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
function GetUseUTF8: boolean;
|
function GetUseUTF8: boolean;
|
||||||
function GetMonoSpace: boolean;
|
function GetMonoSpace: boolean;
|
||||||
{$ENDIF}
|
|
||||||
function CreateColorPen(AColor: TColor; AStyle: LongWord = PS_SOLID): HPen;
|
function CreateColorPen(AColor: TColor; AStyle: LongWord = PS_SOLID): HPen;
|
||||||
property StockDC: HDC read FDC;
|
property StockDC: HDC read FDC;
|
||||||
property DrawingCount: Integer read FDrawingCount;
|
property DrawingCount: Integer read FDrawingCount;
|
||||||
@ -272,10 +257,8 @@ type
|
|||||||
|
|
||||||
property Style: TFontStyles write SetStyle;
|
property Style: TFontStyles write SetStyle;
|
||||||
property CharExtra: Integer read FCharExtra write SetCharExtra;
|
property CharExtra: Integer read FCharExtra write SetCharExtra;
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
property UseUTF8: boolean read GetUseUTF8;
|
property UseUTF8: boolean read GetUseUTF8;
|
||||||
property MonoSpace: boolean read GetMonoSpace;
|
property MonoSpace: boolean read GetMonoSpace;
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TheTextDrawerEx }
|
{ TheTextDrawerEx }
|
||||||
@ -289,9 +272,6 @@ type
|
|||||||
FExtTextOutProc: TheExtTextOutProc;
|
FExtTextOutProc: TheExtTextOutProc;
|
||||||
protected
|
protected
|
||||||
procedure AfterStyleSet; override;
|
procedure AfterStyleSet; override;
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
procedure DoSetCharExtra(Value: Integer); override;
|
|
||||||
{$ENDIF}
|
|
||||||
procedure TextOutOrExtTextOut(X, Y: Integer; fuOptions: UINT;
|
procedure TextOutOrExtTextOut(X, Y: Integer; fuOptions: UINT;
|
||||||
const ARect: TRect; Text: PChar; Length: Integer); virtual;
|
const ARect: TRect; Text: PChar; Length: Integer); virtual;
|
||||||
procedure ExtTextOutFixed(X, Y: Integer; fuOptions: UINT;
|
procedure ExtTextOutFixed(X, Y: Integer; fuOptions: UINT;
|
||||||
@ -307,6 +287,7 @@ type
|
|||||||
|
|
||||||
function GetFontsInfoManager: TheFontsInfoManager;
|
function GetFontsInfoManager: TheFontsInfoManager;
|
||||||
|
|
||||||
|
(*
|
||||||
{$IFNDEF VER93}
|
{$IFNDEF VER93}
|
||||||
{$IFNDEF VER90}
|
{$IFNDEF VER90}
|
||||||
{$IFNDEF VER80}
|
{$IFNDEF VER80}
|
||||||
@ -316,6 +297,7 @@ type
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
*)
|
||||||
|
|
||||||
{$IFNDEF HE_LEADBYTES}
|
{$IFNDEF HE_LEADBYTES}
|
||||||
type
|
type
|
||||||
@ -331,9 +313,7 @@ const
|
|||||||
|
|
||||||
var
|
var
|
||||||
gFontsInfoManager: TheFontsInfoManager;
|
gFontsInfoManager: TheFontsInfoManager;
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
SynTextDrawerFinalization: boolean;
|
SynTextDrawerFinalization: boolean;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFNDEF HE_LEADBYTES}
|
{$IFNDEF HE_LEADBYTES}
|
||||||
LeadBytes: TheLeadByteChars;
|
LeadBytes: TheLeadByteChars;
|
||||||
@ -344,9 +324,7 @@ var
|
|||||||
function GetFontsInfoManager: TheFontsInfoManager;
|
function GetFontsInfoManager: TheFontsInfoManager;
|
||||||
begin
|
begin
|
||||||
if (not Assigned(gFontsInfoManager))
|
if (not Assigned(gFontsInfoManager))
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
and (not SynTextDrawerFinalization)
|
and (not SynTextDrawerFinalization)
|
||||||
{$ENDIF}
|
|
||||||
then
|
then
|
||||||
gFontsInfoManager := TheFontsInfoManager.Create;
|
gFontsInfoManager := TheFontsInfoManager.Create;
|
||||||
Result := gFontsInfoManager;
|
Result := gFontsInfoManager;
|
||||||
@ -374,33 +352,10 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF HE_COMPAREMEM}
|
{$IFNDEF HE_COMPAREMEM}
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean;
|
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := CompareByte(P1^, P2^, Length) = 0;
|
Result := CompareByte(P1^, P2^, Length) = 0;
|
||||||
end;
|
end;
|
||||||
{$ELSE}
|
|
||||||
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;
|
|
||||||
asm
|
|
||||||
PUSH ESI
|
|
||||||
PUSH EDI
|
|
||||||
MOV ESI,P1
|
|
||||||
MOV EDI,P2
|
|
||||||
MOV EDX,ECX
|
|
||||||
XOR EAX,EAX
|
|
||||||
AND EDX,3
|
|
||||||
SHR ECX,1
|
|
||||||
SHR ECX,1
|
|
||||||
REPE CMPSD
|
|
||||||
JNE @@2
|
|
||||||
MOV ECX,EDX
|
|
||||||
REPE CMPSB
|
|
||||||
JNE @@2
|
|
||||||
@@1: INC EAX
|
|
||||||
@@2: POP EDI
|
|
||||||
POP ESI
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function GetStyleIndex(Value: TFontStyles): Integer;
|
function GetStyleIndex(Value: TFontStyles): Integer;
|
||||||
@ -432,17 +387,11 @@ procedure TheFontsInfoManager.UnlockFontsInfo(
|
|||||||
begin
|
begin
|
||||||
with pFontsInfo^ do
|
with pFontsInfo^ do
|
||||||
begin
|
begin
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
if LockCount>0 then begin
|
if LockCount>0 then begin
|
||||||
Dec(LockCount);
|
Dec(LockCount);
|
||||||
if 0 = LockCount then
|
if 0 = LockCount then
|
||||||
DestroyFontHandles(pFontsInfo);
|
DestroyFontHandles(pFontsInfo);
|
||||||
end;
|
end;
|
||||||
{$ELSE}
|
|
||||||
Dec(LockCount);
|
|
||||||
if 0 = LockCount then
|
|
||||||
DestroyFontHandles(pFontsInfo);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -535,8 +484,7 @@ begin
|
|||||||
Inc(Result^.RefCount);
|
Inc(Result^.RefCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TheFontsInfoManager.ReleaseFontsInfo(
|
procedure TheFontsInfoManager.ReleaseFontsInfo(var pFontsInfo: PheSharedFontsInfo);
|
||||||
{$IFDEF SYN_LAZARUS}var {$ENDIF}pFontsInfo: PheSharedFontsInfo);
|
|
||||||
begin
|
begin
|
||||||
ASSERT(Assigned(pFontsInfo));
|
ASSERT(Assigned(pFontsInfo));
|
||||||
|
|
||||||
@ -558,13 +506,11 @@ begin
|
|||||||
Dispose(pFontsInfo);
|
Dispose(pFontsInfo);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
pFontsInfo:=nil;
|
pFontsInfo:=nil;
|
||||||
if SynTextDrawerFinalization and (FFontsInfo.Count=0) then
|
if SynTextDrawerFinalization and (FFontsInfo.Count=0) then
|
||||||
// the program is in the finalization phase
|
// the program is in the finalization phase
|
||||||
// and this object is not used anymore -> destroy it
|
// and this object is not used anymore -> destroy it
|
||||||
Free;
|
Free;
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TheFontStock }
|
{ TheFontStock }
|
||||||
@ -852,9 +798,6 @@ begin
|
|||||||
FUsingFontHandles := False;
|
FUsingFontHandles := False;
|
||||||
end;
|
end;
|
||||||
ReleaseFontsInfo(FpInfo);
|
ReleaseFontsInfo(FpInfo);
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
FpInfo := nil;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -866,10 +809,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
pInfo := GetFontsInfoManager.GetFontsInfo(Value);
|
pInfo := GetFontsInfoManager.GetFontsInfo(Value);
|
||||||
if pInfo = FpInfo then begin
|
if pInfo = FpInfo then begin
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
// GetFontsInfo has increased the refcount, but we already have the font
|
// GetFontsInfo has increased the refcount, but we already have the font
|
||||||
// -> decrease the refcount
|
// -> decrease the refcount
|
||||||
{$ENDIF}
|
|
||||||
GetFontsInfoManager.ReleaseFontsInfo(pInfo);
|
GetFontsInfoManager.ReleaseFontsInfo(pInfo);
|
||||||
end else begin
|
end else begin
|
||||||
ReleaseFontsInfo;
|
ReleaseFontsInfo;
|
||||||
@ -918,21 +859,15 @@ begin
|
|||||||
hOldFont := SelectObject(DC, FCrntFont);
|
hOldFont := SelectObject(DC, FCrntFont);
|
||||||
|
|
||||||
// retrieve height and advances of new font
|
// retrieve height and advances of new font
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
FpInfo^.IsDBCSFont := (0 <> (GCP_DBCS and GetFontLanguageInfo(DC)));
|
FpInfo^.IsDBCSFont := (0 <> (GCP_DBCS and GetFontLanguageInfo(DC)));
|
||||||
//debugln('TheFontStock.SetStyle A IsDBCSFont=',IsDBCSFont);
|
//debugln('TheFontStock.SetStyle A IsDBCSFont=',IsDBCSFont);
|
||||||
{$ENDIF}
|
|
||||||
FpCrntFontData^.Handle := FCrntFont;
|
FpCrntFontData^.Handle := FCrntFont;
|
||||||
CalcFontAdvance(DC, FpCrntFontData, Max(BaseFont.Size, BaseFont.Height));
|
CalcFontAdvance(DC, FpCrntFontData, Max(BaseFont.Size, BaseFont.Height));
|
||||||
//if FpCrntFontData^.NeedETO then debugln(['Needing ETO fot Font=',BaseFont.Name, ' Height=', BaseFont.Height, ' Style=', integer(Value) ]);
|
//if FpCrntFontData^.NeedETO then debugln(['Needing ETO fot Font=',BaseFont.Name, ' Height=', BaseFont.Height, ' Style=', integer(Value) ]);
|
||||||
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
hOldFont:=SelectObject(DC, hOldFont);
|
hOldFont:=SelectObject(DC, hOldFont);
|
||||||
if hOldFont<>FCrntFont then
|
if hOldFont<>FCrntFont then
|
||||||
RaiseGDBException('TheFontStock.SetStyle LCL interface lost the font');
|
RaiseGDBException('TheFontStock.SetStyle LCL interface lost the font');
|
||||||
{$ELSE}
|
|
||||||
SelectObject(DC, hOldFont);
|
|
||||||
{$ENDIF}
|
|
||||||
InternalReleaseDC(DC);
|
InternalReleaseDC(DC);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -979,7 +914,6 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
function TheTextDrawer.GetUseUTF8: boolean;
|
function TheTextDrawer.GetUseUTF8: boolean;
|
||||||
begin
|
begin
|
||||||
FFontStock.BaseFont.Reference;
|
FFontStock.BaseFont.Reference;
|
||||||
@ -994,8 +928,6 @@ begin
|
|||||||
//debugln('TheTextDrawer.GetMonoSpace ',FFontStock.BaseFont.Name,' ',dbgs(FFontStock.BaseFont.IsMonoSpace),' ',dbgs(FFontStock.BaseFont.HandleAllocated));
|
//debugln('TheTextDrawer.GetMonoSpace ',FFontStock.BaseFont.Name,' ',dbgs(FFontStock.BaseFont.IsMonoSpace),' ',dbgs(FFontStock.BaseFont.HandleAllocated));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
function TheTextDrawer.CreateColorPen(AColor: TColor; AStyle: LongWord = PS_SOLID): HPen;
|
function TheTextDrawer.CreateColorPen(AColor: TColor; AStyle: LongWord = PS_SOLID): HPen;
|
||||||
var
|
var
|
||||||
ALogBrush: TLogBrush;
|
ALogBrush: TLogBrush;
|
||||||
@ -1044,16 +976,9 @@ begin
|
|||||||
ASSERT((FDC = 0) and (DC <> 0) and (FDrawingCount = 0));
|
ASSERT((FDC = 0) and (DC <> 0) and (FDrawingCount = 0));
|
||||||
FDC := DC;
|
FDC := DC;
|
||||||
FSaveDC := SaveDC(DC);
|
FSaveDC := SaveDC(DC);
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
SelectObject(DC, FCrntFont);
|
|
||||||
Windows.SetTextColor(DC, ColorToRGB(FColor));
|
|
||||||
Windows.SetBkColor(DC, ColorToRGB(FBkColor));
|
|
||||||
DoSetCharExtra(FCharExtra);
|
|
||||||
{$ELSE}
|
|
||||||
FSavedFont := SelectObject(DC, FCrntFont);
|
FSavedFont := SelectObject(DC, FCrntFont);
|
||||||
LCLIntf.SetTextColor(DC, TColorRef(FColor));
|
LCLIntf.SetTextColor(DC, TColorRef(FColor));
|
||||||
LCLIntf.SetBkColor(DC, TColorRef(FBkColor));
|
LCLIntf.SetBkColor(DC, TColorRef(FBkColor));
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
Inc(FDrawingCount);
|
Inc(FDrawingCount);
|
||||||
end;
|
end;
|
||||||
@ -1066,10 +991,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
if FDC <> 0 then
|
if FDC <> 0 then
|
||||||
begin
|
begin
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
if FSavedFont <> 0 then
|
if FSavedFont <> 0 then
|
||||||
SelectObject(FDC, FSavedFont);
|
SelectObject(FDC, FSavedFont);
|
||||||
{$ENDIF}
|
|
||||||
RestoreDC(FDC, FSaveDC);
|
RestoreDC(FDC, FSaveDC);
|
||||||
end;
|
end;
|
||||||
FSaveDC := 0;
|
FSaveDC := 0;
|
||||||
@ -1160,11 +1083,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
FColor := Value;
|
FColor := Value;
|
||||||
if FDC <> 0 then
|
if FDC <> 0 then
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
SetTextColor(FDC, TColorRef(Value));
|
SetTextColor(FDC, TColorRef(Value));
|
||||||
{$ELSE}
|
|
||||||
SetTextColor(FDC, ColorToRGB(Value));
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1174,11 +1093,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
FBkColor := Value;
|
FBkColor := Value;
|
||||||
if FDC <> 0 then
|
if FDC <> 0 then
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.SetBkColor(FDC, TColorRef(Value));
|
LCLIntf.SetBkColor(FDC, TColorRef(Value));
|
||||||
{$ELSE}
|
|
||||||
Windows.SetBkColor(FDC, ColorToRGB(Value));
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1203,30 +1118,14 @@ begin
|
|||||||
if FCharExtra <> Value then
|
if FCharExtra <> Value then
|
||||||
begin
|
begin
|
||||||
FCharExtra := Value;
|
FCharExtra := Value;
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
FETOSizeInChar := 0;
|
FETOSizeInChar := 0;
|
||||||
{$ELSE}
|
|
||||||
DoSetCharExtra(FCharExtra);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
procedure TheTextDrawer.DoSetCharExtra(Value: Integer);
|
|
||||||
begin
|
|
||||||
if FDC <> 0 then
|
|
||||||
SetTextCharacterExtra(FDC, Value);
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
procedure TheTextDrawer.TextOut(X, Y: Integer; Text: PChar;
|
procedure TheTextDrawer.TextOut(X, Y: Integer; Text: PChar;
|
||||||
Length: Integer);
|
Length: Integer);
|
||||||
begin
|
begin
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.TextOut(FDC, X, Y, Text, Length);
|
LCLIntf.TextOut(FDC, X, Y, Text, Length);
|
||||||
{$ELSE}
|
|
||||||
Windows.TextOut(FDC, X, Y, Text, Length);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TheTextDrawer.ExtTextOut(X, Y: Integer; fuOptions: UINT;
|
procedure TheTextDrawer.ExtTextOut(X, Y: Integer; fuOptions: UINT;
|
||||||
@ -1234,7 +1133,7 @@ procedure TheTextDrawer.ExtTextOut(X, Y: Integer; fuOptions: UINT;
|
|||||||
|
|
||||||
procedure InitETODist(InitValue: Integer);
|
procedure InitETODist(InitValue: Integer);
|
||||||
const
|
const
|
||||||
EtoBlockSize = $40;
|
EtoBlockSize = $40;
|
||||||
var
|
var
|
||||||
NewSize: Integer;
|
NewSize: Integer;
|
||||||
TmpLen: Integer;
|
TmpLen: Integer;
|
||||||
@ -1244,11 +1143,7 @@ procedure TheTextDrawer.ExtTextOut(X, Y: Integer; fuOptions: UINT;
|
|||||||
TmpLen := ((not (EtoBlockSize - 1)) and Length) + EtoBlockSize;
|
TmpLen := ((not (EtoBlockSize - 1)) and Length) + EtoBlockSize;
|
||||||
NewSize := TmpLen * SizeOf(Integer);
|
NewSize := TmpLen * SizeOf(Integer);
|
||||||
ReallocMem(FETODist, NewSize);
|
ReallocMem(FETODist, NewSize);
|
||||||
{$IFDEF FPC}
|
|
||||||
p := PInteger(FETODist + (FETOSizeInChar * SizeOf(Integer)));
|
p := PInteger(FETODist + (FETOSizeInChar * SizeOf(Integer)));
|
||||||
{$ELSE}
|
|
||||||
p := PInteger(Integer(FETODist) + FETOSizeInChar * SizeOf(Integer));
|
|
||||||
{$ENDIF}
|
|
||||||
for i := 1 to TmpLen - FETOSizeInChar do
|
for i := 1 to TmpLen - FETOSizeInChar do
|
||||||
begin
|
begin
|
||||||
p^ := InitValue;
|
p^ := InitValue;
|
||||||
@ -1442,19 +1337,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
procedure TheTextDrawerEx.DoSetCharExtra(Value: Integer);
|
|
||||||
begin
|
|
||||||
if not FontStock.IsDBCSFont then
|
|
||||||
begin
|
|
||||||
SetBkMode(StockDC, OPAQUE);
|
|
||||||
SetTextCharacterExtra(StockDC, Value + FCrntDx);
|
|
||||||
end
|
|
||||||
else if FCrntDBDx = DBCHAR_CALCULATION_FALED then
|
|
||||||
SetTextCharacterExtra(StockDC, Value);
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
procedure TheTextDrawerEx.ExtTextOut(X, Y: Integer; fuOptions: UINT;
|
procedure TheTextDrawerEx.ExtTextOut(X, Y: Integer; fuOptions: UINT;
|
||||||
const ARect: TRect; Text: PChar; Length: Integer; FrameBottom: Integer = -1);
|
const ARect: TRect; Text: PChar; Length: Integer; FrameBottom: Integer = -1);
|
||||||
begin
|
begin
|
||||||
@ -1464,11 +1346,7 @@ end;
|
|||||||
procedure TheTextDrawerEx.ExtTextOutFixed(X, Y: Integer; fuOptions: UINT;
|
procedure TheTextDrawerEx.ExtTextOutFixed(X, Y: Integer; fuOptions: UINT;
|
||||||
const ARect: TRect; Text: PChar; Length: Integer);
|
const ARect: TRect; Text: PChar; Length: Integer);
|
||||||
begin
|
begin
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @ARect, Text, Length, nil);
|
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @ARect, Text, Length, nil);
|
||||||
{$ELSE}
|
|
||||||
Windows.ExtTextOut(StockDC, X, Y, fuOptions, @ARect, Text, Length, nil);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TheTextDrawerEx.ExtTextOutForDBCS(X, Y: Integer; fuOptions: UINT;
|
procedure TheTextDrawerEx.ExtTextOutForDBCS(X, Y: Integer; fuOptions: UINT;
|
||||||
@ -1497,11 +1375,7 @@ var
|
|||||||
begin
|
begin
|
||||||
pCrnt := Text;
|
pCrnt := Text;
|
||||||
pRun := Text;
|
pRun := Text;
|
||||||
{$IFDEF FPC}
|
|
||||||
pTail := PChar(Pointer(Text) + Length);
|
pTail := PChar(Pointer(Text) + Length);
|
||||||
{$ELSE}
|
|
||||||
pTail := PChar(Integer(Text) + Length);
|
|
||||||
{$ENDIF}
|
|
||||||
TmpRect := ARect;
|
TmpRect := ARect;
|
||||||
while pCrnt < pTail do
|
while pCrnt < pTail do
|
||||||
begin
|
begin
|
||||||
@ -1509,20 +1383,12 @@ begin
|
|||||||
if pRun <> pCrnt then
|
if pRun <> pCrnt then
|
||||||
begin
|
begin
|
||||||
SetTextCharacterExtra(StockDC, FCharExtra + FCrntDx);
|
SetTextCharacterExtra(StockDC, FCharExtra + FCrntDx);
|
||||||
{$IFDEF FPC}
|
|
||||||
Len := PtrUInt(pRun) - PtrUInt(pCrnt);
|
Len := PtrUInt(pRun) - PtrUInt(pCrnt);
|
||||||
{$ELSE}
|
|
||||||
Len := Integer(pRun) - Integer(pCrnt);
|
|
||||||
{$ENDIF}
|
|
||||||
with TmpRect do
|
with TmpRect do
|
||||||
begin
|
begin
|
||||||
n := GetCharWidth * Len;
|
n := GetCharWidth * Len;
|
||||||
Right := Min(Left + n + GetCharWidth, ARect.Right);
|
Right := Min(Left + n + GetCharWidth, ARect.Right);
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, pCrnt, Len, nil);
|
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, pCrnt, Len, nil);
|
||||||
{$ELSE}
|
|
||||||
Windows.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, pCrnt, Len, nil);
|
|
||||||
{$ENDIF}
|
|
||||||
Inc(X, n);
|
Inc(X, n);
|
||||||
Inc(Left, n);
|
Inc(Left, n);
|
||||||
end;
|
end;
|
||||||
@ -1533,20 +1399,12 @@ begin
|
|||||||
|
|
||||||
GetDBCharRange;
|
GetDBCharRange;
|
||||||
SetTextCharacterExtra(StockDC, FCharExtra + FCrntDBDx);
|
SetTextCharacterExtra(StockDC, FCharExtra + FCrntDBDx);
|
||||||
{$IFDEF FPC}
|
|
||||||
Len := PtrUInt(pRun) - PtrUInt(pCrnt);
|
Len := PtrUInt(pRun) - PtrUInt(pCrnt);
|
||||||
{$ELSE}
|
|
||||||
Len := Integer(pRun) - Integer(pCrnt);
|
|
||||||
{$ENDIF}
|
|
||||||
with TmpRect do
|
with TmpRect do
|
||||||
begin
|
begin
|
||||||
n := GetCharWidth * Len;
|
n := GetCharWidth * Len;
|
||||||
Right := Min(Left + n + GetCharWidth, ARect.Right);
|
Right := Min(Left + n + GetCharWidth, ARect.Right);
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, pCrnt, Len, nil);
|
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, pCrnt, Len, nil);
|
||||||
{$ELSE}
|
|
||||||
Windows.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, pCrnt, Len, nil);
|
|
||||||
{$ENDIF}
|
|
||||||
Inc(X, n);
|
Inc(X, n);
|
||||||
Inc(Left, n);
|
Inc(Left, n);
|
||||||
end;
|
end;
|
||||||
@ -1557,11 +1415,7 @@ begin
|
|||||||
(TmpRect.Right < ARect.Right) then
|
(TmpRect.Right < ARect.Right) then
|
||||||
begin
|
begin
|
||||||
SetTextCharacterExtra(StockDC, FCharExtra + FCrntDx);
|
SetTextCharacterExtra(StockDC, FCharExtra + FCrntDx);
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, nil, 0, nil);
|
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, nil, 0, nil);
|
||||||
{$ELSE}
|
|
||||||
Windows.ExtTextOut(StockDC, X, Y, fuOptions, @TmpRect, nil, 0, nil);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1586,17 +1440,9 @@ begin
|
|||||||
and
|
and
|
||||||
(Left + GetCharWidth * (Length + 1) > Right)
|
(Left + GetCharWidth * (Length + 1) > Right)
|
||||||
then
|
then
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.TextOut(StockDC, X, Y, Text, Length)
|
LCLIntf.TextOut(StockDC, X, Y, Text, Length)
|
||||||
{$ELSE}
|
|
||||||
Windows.TextOut(StockDC, X, Y, Text, Length)
|
|
||||||
{$ENDIF}
|
|
||||||
else
|
else
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @ARect, Text, Length, nil)
|
LCLIntf.ExtTextOut(StockDC, X, Y, fuOptions, @ARect, Text, Length, nil)
|
||||||
{$ELSE}
|
|
||||||
Windows.ExtTextOut(StockDC, X, Y, fuOptions, @ARect, Text, Length, nil)
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF HE_LEADBYTES}
|
{$IFNDEF HE_LEADBYTES}
|
||||||
@ -1611,15 +1457,12 @@ end;
|
|||||||
{$ENDIF} // HE_LEADBYTES
|
{$ENDIF} // HE_LEADBYTES
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
SynTextDrawerFinalization:=false;
|
SynTextDrawerFinalization:=false;
|
||||||
{$ENDIF}
|
|
||||||
{$IFNDEF HE_LEADBYTES}
|
{$IFNDEF HE_LEADBYTES}
|
||||||
InitializeLeadBytes;
|
InitializeLeadBytes;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
// MG: We can't free the gFontsInfoManager here, because the synedit
|
// MG: We can't free the gFontsInfoManager here, because the synedit
|
||||||
// components need it and will be destroyed with the Application object in
|
// components need it and will be destroyed with the Application object in
|
||||||
// the lcl after this finalization section.
|
// the lcl after this finalization section.
|
||||||
@ -1629,9 +1472,6 @@ finalization
|
|||||||
if Assigned(gFontsInfoManager) and (gFontsInfoManager.FFontsInfo.Count=0)
|
if Assigned(gFontsInfoManager) and (gFontsInfoManager.FFontsInfo.Count=0)
|
||||||
then
|
then
|
||||||
FreeAndNil(gFontsInfoManager);
|
FreeAndNil(gFontsInfoManager);
|
||||||
{$ELSE}
|
|
||||||
FreeAndNil(gFontsInfoManager);
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user