From a2359e13a8273dc25ad7fa5c02be8d2b9e6d512d Mon Sep 17 00:00:00 2001 From: skalogryz Date: Mon, 17 Nov 2014 07:04:27 +0000 Subject: [PATCH] richmemo: gtk2 set metric git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3735 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/richmemo/gtk2/gtk2richmemo.pas | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/components/richmemo/gtk2/gtk2richmemo.pas b/components/richmemo/gtk2/gtk2richmemo.pas index b94fbcfaf..450e8b71e 100644 --- a/components/richmemo/gtk2/gtk2richmemo.pas +++ b/components/richmemo/gtk2/gtk2richmemo.pas @@ -56,6 +56,9 @@ type class procedure SetParaAlignment(const AWinControl: TWinControl; TextStart, TextLen: Integer; const AAlign: Integer); override; + class procedure SetParaMetric(const AWinControl: TWinControl; TextStart, TextLen: Integer; + const AMetric: TIntParaMetric); override; + class procedure InDelText(const AWinControl: TWinControl; const TextUTF8: String; DstStart, DstLen: Integer); override; end; @@ -301,6 +304,50 @@ begin ApplyTag(buffer, tag, TextStart, TextLen, true); end; +class procedure TGtk2WSCustomRichMemo.SetParaMetric( + const AWinControl: TWinControl; TextStart, TextLen: Integer; + const AMetric: TIntParaMetric); +var + w : PGtkWidget; + buffer : PGtkTextBuffer; + tag : PGtkTextTag; + h : double; + fl : double; + t : double; +const + ScreenDPI = 96; // todo: might change, should be received dynamically + PageDPI = 72; // not expected to be changed + DPIFactor = ScreenDPI / PageDPI; +begin + h:=AMetric.HeadIndent; + if h<0 then h:=0; + fl:=AMetric.FirstLine; + if fl<0 then fl:=0; + + if fl