You've already forked lazarus-ccr
fix for win32RichMemo background color as suggested by Dusan.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@919 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -211,9 +211,10 @@ end;
|
||||
function TCustomRichMemo.GetStyleRange(CharOfs: Integer; var RangeStart,
|
||||
RangeLen: Integer): Boolean;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
Result := TWSCustomRichMemoClass(WidgetSetClass).GetStyleRange(Self, CharOfs, RangeStart, RangeLen)
|
||||
else begin
|
||||
if HandleAllocated then begin
|
||||
Result := TWSCustomRichMemoClass(WidgetSetClass).GetStyleRange(Self, CharOfs, RangeStart, RangeLen);
|
||||
if Result and (RangeLen = 0) then RangeLen := 1;
|
||||
end else begin
|
||||
RangeStart := -1;
|
||||
RangeLen := -1;
|
||||
Result := false;
|
||||
|
@ -42,6 +42,8 @@ type
|
||||
|
||||
TWin32WSCustomRichMemo = class(TWSCustomRichMemo)
|
||||
published
|
||||
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||
|
||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
|
||||
@ -92,6 +94,13 @@ end;
|
||||
|
||||
{ TWin32WSCustomRichMemo }
|
||||
|
||||
class procedure TWin32WSCustomRichMemo.SetColor(const AWinControl: TWinControl);
|
||||
begin
|
||||
// this methos is implemented, because Win32RichMemo doesn't use
|
||||
// default LCL WM_PAINT message!
|
||||
SendMessage(AWinControl.Handle, EM_SETBKGNDCOLOR, 0, AWinControl.Color);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomRichMemo.SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer);
|
||||
var
|
||||
range : Tcharrange;
|
||||
@ -151,8 +160,10 @@ begin
|
||||
Flags := Flags and not WS_HSCROLL
|
||||
else
|
||||
Flags := Flags or ES_AUTOHSCROLL;
|
||||
|
||||
if ACustomMemo.BorderStyle=bsSingle then
|
||||
FlagsEx := FlagsEx or WS_EX_CLIENTEDGE;
|
||||
|
||||
pClassName := @RichClass[1];
|
||||
WindowTitle := StrCaption;
|
||||
end;
|
||||
@ -185,19 +196,23 @@ begin
|
||||
RichEditManager.SetSelectedTextStyle(AWinControl.Handle, Params);
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomRichMemo.GetTextAttributes(
|
||||
const AWinControl: TWinControl; TextStart: Integer; var Params: TIntFontParams
|
||||
): Boolean;
|
||||
class function TWin32WSCustomRichMemo.GetTextAttributes(const AWinControl: TWinControl;
|
||||
TextStart: Integer; var Params: TIntFontParams): Boolean;
|
||||
var
|
||||
OrigStart : Integer;
|
||||
OrigLen : Integer;
|
||||
NeedLock : Boolean;
|
||||
eventmask : LongWord;
|
||||
begin
|
||||
writeln('[GetTextAttributes] begin');
|
||||
if not Assigned(RichEditManager) or not Assigned(AWinControl) then begin
|
||||
Result := false;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
eventmask := SendMessage(AWinControl.Handle, EM_GETEVENTMASK, 0, 0);
|
||||
SendMessage(AWinControl.Handle, EM_SETEVENTMASK, 0, 0);
|
||||
|
||||
RichEditManager.GetSelection(AWinControl.Handle, OrigStart, OrigLen);
|
||||
|
||||
NeedLock := (OrigStart <> TextStart);
|
||||
@ -207,8 +222,14 @@ begin
|
||||
Result := RichEditManager.GetSelectedTextStyle(AWinControl.Handle, Params );
|
||||
RichEditManager.SetSelection(AWinControl.Handle, OrigStart, OrigLen);
|
||||
UnlockRedraw(AWinControl.Handle);
|
||||
end else
|
||||
end else begin
|
||||
LockRedraw(AWinControl.Handle);
|
||||
Result := RichEditManager.GetSelectedTextStyle(AWinControl.Handle, Params);
|
||||
UnlockRedraw(AWinControl.Handle);
|
||||
end;
|
||||
|
||||
SendMessage(AWinControl.Handle, EM_SETEVENTMASK, 0, eventmask);
|
||||
writeln('[GetTextAttributes] end');
|
||||
end;
|
||||
|
||||
|
||||
@ -236,12 +257,16 @@ var
|
||||
vInfo : TScrollInfo;
|
||||
hVisible : Boolean;
|
||||
vVisible : Boolean;
|
||||
eventmask : longword;
|
||||
begin
|
||||
if not Assigned(RichEditManager) or not Assigned(AWinControl) then begin
|
||||
Result := false;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
eventmask := SendMessage(AWinControl.Handle, EM_GETEVENTMASK, 0, 0);
|
||||
SendMessage(AWinControl.Handle, EM_SETEVENTMASK, 0, 0);
|
||||
|
||||
RichEditManager.GetSelection(AWinControl.Handle, OrigStart, OrigLen);
|
||||
LockRedraw(AWinControl.Handle);
|
||||
InitScrollInfo(hInfo);
|
||||
@ -261,6 +286,8 @@ begin
|
||||
if vVisible then SetScrollInfo(AWinControl.Handle, SB_Vert, vInfo, false);
|
||||
RichEditManager.SetSelection(AWinControl.Handle, OrigStart, OrigLen);
|
||||
UnlockRedraw(AWinControl.Handle, false);
|
||||
|
||||
SendMessage(AWinControl.Handle, EM_SETEVENTMASK, 0, eventmask);
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomRichMemo.LoadRichText(
|
||||
|
@ -48,7 +48,6 @@ type
|
||||
class procedure SetHideSelection(RichEditWnd: Handle; AValue: Boolean); virtual;
|
||||
class function LoadRichText(RichEditWnd: Handle; ASrc: TStream): Boolean; virtual;
|
||||
class function SaveRichText(RichEditWnd: Handle; ADst: TStream): Boolean; virtual;
|
||||
|
||||
end;
|
||||
TRichManagerClass = class of TRichEditManager;
|
||||
|
||||
@ -78,12 +77,13 @@ function InitRichEdit: Boolean;
|
||||
begin
|
||||
if GlobalRichClass = '' then begin
|
||||
if LoadLibrary('Msftedit.dll') <> 0 then begin
|
||||
GlobalRichClass := 'RichEdit50W'
|
||||
GlobalRichClass := 'RichEdit50W';
|
||||
end else if LoadLibrary('RICHED20.DLL') <> 0 then begin
|
||||
if UnicodeEnabledOS then GlobalRichClass := 'RichEdit20W'
|
||||
else GlobalRichClass := 'RichEdit20A'
|
||||
end else if LoadLibrary('RICHED32.DLL') <> 0 then
|
||||
end else if LoadLibrary('RICHED32.DLL') <> 0 then begin
|
||||
GlobalRichClass := 'RichEdit';
|
||||
end;
|
||||
|
||||
if not Assigned(RichEditManager) then
|
||||
RichEditManager := TRichEditManager;
|
||||
@ -208,7 +208,7 @@ begin
|
||||
Result := false;
|
||||
if RichEditWnd = 0 then Exit;
|
||||
|
||||
textlen.flags := GTL_DEFAULT or GTL_NUMCHARS;
|
||||
textlen.flags := GTL_NUMCHARS or GTL_USECRLF or GTL_PRECISE;
|
||||
textlen.codepage := CP_UNICODE;
|
||||
len := SendMessage(RichEditWnd, EM_GETTEXTLENGTHEX, WPARAM(@textlen), 0);
|
||||
|
||||
|
Reference in New Issue
Block a user