You've already forked lazarus-ccr
richmemo: based on the patch by Andrey Korol (#30618), receiving ZoomFactor from widgetset (if hot keys were used to zoom the editor, w/o notifications to LCL). Win32 implementation added.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5306 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -593,6 +593,10 @@ end;
|
||||
function TCustomRichMemo.GetZoomFactor: Double;
|
||||
begin
|
||||
Result:=fZoomFactor;
|
||||
if HandleAllocated then begin
|
||||
if TWSCustomRichMemoClass(WidgetSetClass).GetZoomFactor(Self, Result) then
|
||||
fZoomFactor:=Result;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomRichMemo.SetZoomFactor(AValue: Double);
|
||||
|
@@ -127,6 +127,7 @@ type
|
||||
const SearchOpts: TIntSearchOpt; var ATextStart, ATextLength: Integer ): Boolean; override;
|
||||
|
||||
class procedure SetZoomFactor(const AWinControl: TWinControl; AZoomFactor: Double); override;
|
||||
class function GetZoomFactor(const AWinControl: TWinControl; var AZoomFactor: Double): Boolean; override;
|
||||
|
||||
class function InlineInsert(const AWinControl: TWinControl; ATextStart, ATextLength: Integer;
|
||||
const ASize: TSize; AHandler: TRichMemoInline; var wsObj: TRichMemoInlineWSObject): Boolean; override;
|
||||
@@ -1209,6 +1210,18 @@ begin
|
||||
SendMessage( AWinControl.Handle, EM_SETZOOM, round(AZoomFactor * DN), DN);
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomRichMemo.GetZoomFactor(const AWinControl: TWinControl; var AZoomFactor: Double): Boolean;
|
||||
var
|
||||
numerator, denominator: Integer; // todo: Are they always integers? or can they be something else in 64-bit?
|
||||
begin
|
||||
Result:=SendMessage(AWinControl.Handle, EM_GETZOOM, WParam(@numerator), LParam(@denominator))<>0;
|
||||
if Result then begin
|
||||
Result:=(numerator <> 0) and (denominator <> 0);
|
||||
if Result then
|
||||
AZoomFactor := double(numerator)/ double(denominator);
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomRichMemo.InlineInsert(
|
||||
const AWinControl: TWinControl; ATextStart, ATextLength: Integer;
|
||||
const ASize: TSize; AHandler: TRichMemoInline;
|
||||
|
@@ -106,6 +106,7 @@ type
|
||||
class function SearchEx(const AWinControl: TWinControl; const ANiddle: string; const SearchOpts: TIntSearchOpt; var TextStart, TextLength: Integer): Boolean; virtual;
|
||||
|
||||
class procedure SetZoomFactor(const AWinControl: TWinControl; AZoomFactor: Double); virtual;
|
||||
class function GetZoomFactor(const AWinControl: TWinControl; var AZoomFactor:Double): Boolean; virtual;
|
||||
|
||||
//inline handler
|
||||
class function InlineInsert(const AWinControl: TWinControl; ATextStart, ATextLength: Integer;
|
||||
@@ -379,6 +380,11 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
class function TWSCustomRichMemo.GetZoomFactor(const AWinControl: TWinControl; var AZoomFactor: Double): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
class function TWSCustomRichMemo.InlineInsert(const AWinControl: TWinControl;
|
||||
ATextStart, ATextLength: Integer; const ASize: TSize; AHandler: TRichMemoInline;
|
||||
var wsObj: TRichMemoInlineWSObject): Boolean;
|
||||
|
Reference in New Issue
Block a user