You've already forked lazarus-ccr
richmemo: introducing zoomfactor property with win32 implementation.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3827 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -88,6 +88,7 @@ type
|
|||||||
private
|
private
|
||||||
fHideSelection : Boolean;
|
fHideSelection : Boolean;
|
||||||
fOnSelectionChange: TNotifyEvent;
|
fOnSelectionChange: TNotifyEvent;
|
||||||
|
fZoomFactor : Double;
|
||||||
protected
|
protected
|
||||||
procedure DoSelectionChange;
|
procedure DoSelectionChange;
|
||||||
class procedure WSRegisterClass; override;
|
class procedure WSRegisterClass; override;
|
||||||
@ -97,7 +98,10 @@ type
|
|||||||
function GetContStyleLength(TextStart: Integer): Integer;
|
function GetContStyleLength(TextStart: Integer): Integer;
|
||||||
|
|
||||||
procedure SetSelText(const SelTextUTF8: string); override;
|
procedure SetSelText(const SelTextUTF8: string); override;
|
||||||
|
function GetZoomFactor: Double; virtual;
|
||||||
|
procedure SetZoomFactor(AValue: Double); virtual;
|
||||||
public
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure CopyToClipboard; override;
|
procedure CopyToClipboard; override;
|
||||||
procedure CutToClipboard; override;
|
procedure CutToClipboard; override;
|
||||||
procedure PasteFromClipboard; override;
|
procedure PasteFromClipboard; override;
|
||||||
@ -136,6 +140,7 @@ type
|
|||||||
|
|
||||||
property HideSelection : Boolean read fHideSelection write SetHideSelection;
|
property HideSelection : Boolean read fHideSelection write SetHideSelection;
|
||||||
property OnSelectionChange: TNotifyEvent read fOnSelectionChange write fOnSelectionChange;
|
property OnSelectionChange: TNotifyEvent read fOnSelectionChange write fOnSelectionChange;
|
||||||
|
property ZoomFactor: Double read GetZoomFactor write SetZoomFactor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRichMemo }
|
{ TRichMemo }
|
||||||
@ -203,6 +208,7 @@ type
|
|||||||
property WantReturns;
|
property WantReturns;
|
||||||
property WantTabs;
|
property WantTabs;
|
||||||
property WordWrap;
|
property WordWrap;
|
||||||
|
property ZoomFactor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InitFontParams(var p: TFontParams);
|
procedure InitFontParams(var p: TFontParams);
|
||||||
@ -325,6 +331,19 @@ begin
|
|||||||
fHideSelection := AValue;
|
fHideSelection := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomRichMemo.GetZoomFactor: Double;
|
||||||
|
begin
|
||||||
|
Result:=fZoomFactor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomRichMemo.SetZoomFactor(AValue: Double);
|
||||||
|
begin
|
||||||
|
if AValue=0 then AValue:=1.0;
|
||||||
|
fZoomFactor:=AValue;
|
||||||
|
if HandleAllocated then
|
||||||
|
TWSCustomRichMemoClass(WidgetSetClass).SetZoomFactor(Self, AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomRichMemo.DoSelectionChange;
|
procedure TCustomRichMemo.DoSelectionChange;
|
||||||
begin
|
begin
|
||||||
if Assigned(fOnSelectionChange) then fOnSelectionChange(Self);
|
if Assigned(fOnSelectionChange) then fOnSelectionChange(Self);
|
||||||
@ -346,6 +365,7 @@ procedure TCustomRichMemo.UpdateRichMemo;
|
|||||||
begin
|
begin
|
||||||
if not HandleAllocated then Exit;
|
if not HandleAllocated then Exit;
|
||||||
TWSCustomRichMemoClass(WidgetSetClass).SetHideSelection(Self, fHideSelection);
|
TWSCustomRichMemoClass(WidgetSetClass).SetHideSelection(Self, fHideSelection);
|
||||||
|
TWSCustomRichMemoClass(WidgetSetClass).SetZoomFactor(Self, fZoomFactor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRichMemo.SetTextAttributes(TextStart, TextLen: Integer;
|
procedure TCustomRichMemo.SetTextAttributes(TextStart, TextLen: Integer;
|
||||||
@ -486,6 +506,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TCustomRichMemo.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
fZoomFactor:=1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCustomRichMemo.CopyToClipboard;
|
procedure TCustomRichMemo.CopyToClipboard;
|
||||||
begin
|
begin
|
||||||
|
@ -103,6 +103,8 @@ type
|
|||||||
|
|
||||||
class function Search(const AWinControl: TWinControl; const ANiddle: string;
|
class function Search(const AWinControl: TWinControl; const ANiddle: string;
|
||||||
const SearchOpts: TIntSearchOpt): Integer; override;
|
const SearchOpts: TIntSearchOpt): Integer; override;
|
||||||
|
|
||||||
|
class procedure SetZoomFactor(const AWinControl: TWinControl; AZoomFactor: Double); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -682,5 +684,15 @@ begin
|
|||||||
Result:=RichEditManager.Find(AWinControl.Handle, UTF8Decode(ANiddle), SearchOpts);
|
Result:=RichEditManager.Find(AWinControl.Handle, UTF8Decode(ANiddle), SearchOpts);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TWin32WSCustomRichMemo.SetZoomFactor(
|
||||||
|
const AWinControl: TWinControl; AZoomFactor: Double);
|
||||||
|
var
|
||||||
|
DN : WParam;
|
||||||
|
begin
|
||||||
|
if not Assigned(RichEditManager) or not Assigned(AWinControl) then Exit;
|
||||||
|
DN := 1000;
|
||||||
|
SendMessage( AWinControl.Handle, EM_SETZOOM, round(AZoomFactor * DN), DN);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -89,6 +89,8 @@ type
|
|||||||
class function SaveRichText(const AWinControl: TWinControl; Dest: TStream): Boolean; virtual;
|
class function SaveRichText(const AWinControl: TWinControl; Dest: TStream): Boolean; virtual;
|
||||||
|
|
||||||
class function Search(const AWinControl: TWinControl; const ANiddle: string; const SearchOpts: TIntSearchOpt): Integer; virtual;
|
class function Search(const AWinControl: TWinControl; const ANiddle: string; const SearchOpts: TIntSearchOpt): Integer; virtual;
|
||||||
|
|
||||||
|
class procedure SetZoomFactor(const AWinControl: TWinControl; AZoomFactor: Double); virtual;
|
||||||
end;
|
end;
|
||||||
TWSCustomRichMemoClass = class of TWSCustomRichMemo;
|
TWSCustomRichMemoClass = class of TWSCustomRichMemo;
|
||||||
|
|
||||||
@ -207,5 +209,11 @@ begin
|
|||||||
Result:=-1;
|
Result:=-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TWSCustomRichMemo.SetZoomFactor(const AWinControl: TWinControl;
|
||||||
|
AZoomFactor: Double);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user