You've already forked lazarus-ccr
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:
@ -28,8 +28,6 @@ uses
|
|||||||
const
|
const
|
||||||
NoResize : TSize = ( cx: 0; cy : 0 );
|
NoResize : TSize = ( cx: 0; cy : 0 );
|
||||||
|
|
||||||
type
|
|
||||||
TInsertOptions = set of (ioBelowBaseLine);
|
|
||||||
var
|
var
|
||||||
{ Disclaimer: the function would insert an image file into RichMemo
|
{ Disclaimer: the function would insert an image file into RichMemo
|
||||||
(if implemented by the widgetset) But in a very inefficient way.
|
(if implemented by the widgetset) But in a very inefficient way.
|
||||||
@ -44,29 +42,25 @@ var
|
|||||||
}
|
}
|
||||||
InsertImageFromFile : function (const ARichMemo: TCustomRichMemo; APos: Integer;
|
InsertImageFromFile : function (const ARichMemo: TCustomRichMemo; APos: Integer;
|
||||||
const FileNameUTF8: string;
|
const FileNameUTF8: string;
|
||||||
const Options : TInsertOptions;
|
|
||||||
const AImgSize: TSize
|
const AImgSize: TSize
|
||||||
): Boolean = nil;
|
): Boolean = nil;
|
||||||
|
|
||||||
function InsertImageFromFileNoResize (const ARichMemo: TCustomRichMemo; APos: Integer;
|
function InsertImageFromFileNoResize (const ARichMemo: TCustomRichMemo; APos: Integer;
|
||||||
const FileNameUTF8: string;
|
const FileNameUTF8: string): Boolean;
|
||||||
const Options : TInsertOptions): Boolean;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function InsertImageFileDummy(const ARichMemo: TCustomRichMemo; APos: Integer;
|
function InsertImageFileDummy(const ARichMemo: TCustomRichMemo; APos: Integer;
|
||||||
const FileNameUTF8: string;
|
const FileNameUTF8: string;
|
||||||
const Options: TInsertOptions;
|
|
||||||
const AImgSize: TSize): Boolean;
|
const AImgSize: TSize): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function InsertImageFromFileNoResize (const ARichMemo: TCustomRichMemo; APos: Integer;
|
function InsertImageFromFileNoResize (const ARichMemo: TCustomRichMemo; APos: Integer;
|
||||||
const FileNameUTF8: string;
|
const FileNameUTF8: string): Boolean;
|
||||||
const Options : TInsertOptions): Boolean;
|
|
||||||
begin
|
begin
|
||||||
Result:=InsertImageFromFile(ARichMemo, APos, FileNameUTF8, Options, NoResize);
|
Result:=InsertImageFromFile(ARichMemo, APos, FileNameUTF8, NoResize);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -538,7 +538,6 @@ end;
|
|||||||
|
|
||||||
function WinInsertImageFromFile (const ARichMemo: TCustomRichMemo; APos: Integer;
|
function WinInsertImageFromFile (const ARichMemo: TCustomRichMemo; APos: Integer;
|
||||||
const FileNameUTF8: string;
|
const FileNameUTF8: string;
|
||||||
const Options: TInsertOptions;
|
|
||||||
const AImgSize: TSize): Boolean;
|
const AImgSize: TSize): Boolean;
|
||||||
var
|
var
|
||||||
hnd : THandle;
|
hnd : THandle;
|
||||||
@ -554,6 +553,10 @@ var
|
|||||||
ImageLink: IOleObject;
|
ImageLink: IOleObject;
|
||||||
|
|
||||||
sl, ss: Integer;
|
sl, ss: Integer;
|
||||||
|
const
|
||||||
|
PointSize = 72.0;
|
||||||
|
RtfSizeToInch = 2.54 * 1000.0;
|
||||||
|
SizeFactor = 1 / PointSize * RtfSizeToInch;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
if not Assigned(ARichMemo) then Exit;
|
if not Assigned(ARichMemo) then Exit;
|
||||||
@ -593,11 +596,9 @@ begin
|
|||||||
if (AImgSize.cx<>0) or (AImgSize.cy<>0) then 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
|
//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.
|
//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.cx:=round(AImgSize.cx * SizeFactor);
|
||||||
Obj.sizel.cy:=round(AImgSize.cy / 72 * 2.54 * 1000);
|
Obj.sizel.cy:=round(AImgSize.cy * SizeFactor);
|
||||||
end;
|
end;
|
||||||
if ioBelowBaseLine in Options then
|
|
||||||
Obj.dwFlags:=Obj.dwFlags or REO_BELOWBASELINE;
|
|
||||||
|
|
||||||
ARichMemo.SelStart:=APos;
|
ARichMemo.SelStart:=APos;
|
||||||
ARichMemo.SelLength:=0;
|
ARichMemo.SelLength:=0;
|
||||||
|
Reference in New Issue
Block a user