richmemo: remove insert options (not supported by any other widgetset, but win32)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3755 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2014-11-20 22:40:17 +00:00
parent 824d6adb92
commit 56614b93e6
2 changed files with 9 additions and 14 deletions

View File

@ -28,8 +28,6 @@ uses
const
NoResize : TSize = ( cx: 0; cy : 0 );
type
TInsertOptions = set of (ioBelowBaseLine);
var
{ Disclaimer: the function would insert an image file into RichMemo
(if implemented by the widgetset) But in a very inefficient way.
@ -44,29 +42,25 @@ var
}
InsertImageFromFile : function (const ARichMemo: TCustomRichMemo; APos: Integer;
const FileNameUTF8: string;
const Options : TInsertOptions;
const AImgSize: TSize
): Boolean = nil;
function InsertImageFromFileNoResize (const ARichMemo: TCustomRichMemo; APos: Integer;
const FileNameUTF8: string;
const Options : TInsertOptions): Boolean;
const FileNameUTF8: string): Boolean;
implementation
function InsertImageFileDummy(const ARichMemo: TCustomRichMemo; APos: Integer;
const FileNameUTF8: string;
const Options: TInsertOptions;
const AImgSize: TSize): Boolean;
begin
Result:=false;
end;
function InsertImageFromFileNoResize (const ARichMemo: TCustomRichMemo; APos: Integer;
const FileNameUTF8: string;
const Options : TInsertOptions): Boolean;
const FileNameUTF8: string): Boolean;
begin
Result:=InsertImageFromFile(ARichMemo, APos, FileNameUTF8, Options, NoResize);
Result:=InsertImageFromFile(ARichMemo, APos, FileNameUTF8, NoResize);
end;
initialization

View File

@ -538,7 +538,6 @@ end;
function WinInsertImageFromFile (const ARichMemo: TCustomRichMemo; APos: Integer;
const FileNameUTF8: string;
const Options: TInsertOptions;
const AImgSize: TSize): Boolean;
var
hnd : THandle;
@ -554,6 +553,10 @@ var
ImageLink: IOleObject;
sl, ss: Integer;
const
PointSize = 72.0;
RtfSizeToInch = 2.54 * 1000.0;
SizeFactor = 1 / PointSize * RtfSizeToInch;
begin
Result:=false;
if not Assigned(ARichMemo) then Exit;
@ -593,11 +596,9 @@ begin
if (AImgSize.cx<>0) or (AImgSize.cy<>0) then begin
//http://msdn.microsoft.com/en-us/library/windows/desktop/bb787946%28v=vs.85%29.aspx
//The size of the object. The unit of measure is 0.01 millimeters, which is a HIMETRIC measurement.
Obj.sizel.cx:=round(AImgSize.cx / 72 * 2.54 * 1000);
Obj.sizel.cy:=round(AImgSize.cy / 72 * 2.54 * 1000);
Obj.sizel.cx:=round(AImgSize.cx * SizeFactor);
Obj.sizel.cy:=round(AImgSize.cy * SizeFactor);
end;
if ioBelowBaseLine in Options then
Obj.dwFlags:=Obj.dwFlags or REO_BELOWBASELINE;
ARichMemo.SelStart:=APos;
ARichMemo.SelLength:=0;