diff --git a/components/richmemo/richmemo.pas b/components/richmemo/richmemo.pas index dccfabbf1..7c5e7fad6 100644 --- a/components/richmemo/richmemo.pas +++ b/components/richmemo/richmemo.pas @@ -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); diff --git a/components/richmemo/win32/win32richmemo.pas b/components/richmemo/win32/win32richmemo.pas index a2a9095f0..58a233adb 100644 --- a/components/richmemo/win32/win32richmemo.pas +++ b/components/richmemo/win32/win32richmemo.pas @@ -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; diff --git a/components/richmemo/wsrichmemo.pas b/components/richmemo/wsrichmemo.pas index 10b8150b9..a612bc837 100644 --- a/components/richmemo/wsrichmemo.pas +++ b/components/richmemo/wsrichmemo.pas @@ -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;