mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 22:39:14 +02:00
LCL/SynEdit: w32 IME improvements
git-svn-id: trunk@35865 -
This commit is contained in:
parent
202ad17315
commit
0fd8705211
@ -436,14 +436,17 @@ type
|
|||||||
TCustomSynEdit = class(TSynEditBase)
|
TCustomSynEdit = class(TSynEditBase)
|
||||||
procedure SelAvailChange(Sender: TObject);
|
procedure SelAvailChange(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
FImeWinX, FImeWinY: Integer;
|
||||||
|
procedure UpdateImeWinXY(aX, aY: Integer; aImc: HIMC = 0; aForce: Boolean = False);
|
||||||
|
procedure UpdateImeWinFont(aImc: HIMC = 0);
|
||||||
|
//procedure WMImeComposition(var Msg: TMessage); message WM_IME_COMPOSITION;
|
||||||
|
procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY;
|
||||||
|
{$ENDIF}
|
||||||
procedure WMDropFiles(var Msg: TMessage); message WM_DROPFILES;
|
procedure WMDropFiles(var Msg: TMessage); message WM_DROPFILES;
|
||||||
procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
|
procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
|
||||||
procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE;
|
procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE;
|
||||||
procedure WMHScroll(var Msg: {$IFDEF SYN_LAZARUS}TLMScroll{$ELSE}TWMScroll{$ENDIF}); message WM_HSCROLL;
|
procedure WMHScroll(var Msg: {$IFDEF SYN_LAZARUS}TLMScroll{$ELSE}TWMScroll{$ENDIF}); message WM_HSCROLL;
|
||||||
{$IFDEF SYN_MBCSSUPPORT}
|
|
||||||
procedure WMImeComposition(var Msg: TMessage); message WM_IME_COMPOSITION;
|
|
||||||
procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY;
|
|
||||||
{$ENDIF}
|
|
||||||
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
|
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
|
||||||
procedure WMExit(var Message: TLMExit); message LM_EXIT;
|
procedure WMExit(var Message: TLMExit); message LM_EXIT;
|
||||||
procedure WMMouseWheel(var Message: TLMMouseEvent); message LM_MOUSEWHEEL;
|
procedure WMMouseWheel(var Message: TLMMouseEvent); message LM_MOUSEWHEEL;
|
||||||
@ -2515,7 +2518,49 @@ begin
|
|||||||
Result := '';
|
Result := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF SYN_MBCSSUPPORT}
|
{$IFDEF WinIME}
|
||||||
|
procedure TCustomSynEdit.UpdateImeWinXY(aX, aY: Integer; aImc: HIMC; aForce: Boolean);
|
||||||
|
var
|
||||||
|
cf: CompositionForm;
|
||||||
|
imc: HIMC;
|
||||||
|
begin
|
||||||
|
if not HandleAllocated then exit;
|
||||||
|
if (not aForce) and (aX = FImeWinX) and (aY = FImeWinY) then exit;
|
||||||
|
FImeWinX := aX;
|
||||||
|
FImeWinY := aY;
|
||||||
|
|
||||||
|
cf.dwStyle := CFS_POINT;
|
||||||
|
cf.ptCurrentPos := Point(aX, aY);
|
||||||
|
if aImc = 0 then
|
||||||
|
imc := ImmGetContext(Handle)
|
||||||
|
else
|
||||||
|
imc := aImc;
|
||||||
|
if (imc <> 0) then begin
|
||||||
|
ImmSetCompositionWindow(imc, @cf);
|
||||||
|
if (aImc = 0) then
|
||||||
|
ImmReleaseContext(Handle, imc);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.UpdateImeWinFont(aImc: HIMC);
|
||||||
|
var
|
||||||
|
imc: HIMC;
|
||||||
|
logFont: TLogFont;
|
||||||
|
begin
|
||||||
|
if not HandleAllocated then exit;
|
||||||
|
if aImc = 0 then
|
||||||
|
imc := ImmGetContext(Handle)
|
||||||
|
else
|
||||||
|
imc := aImc;
|
||||||
|
if (imc <> 0) then begin
|
||||||
|
GetObject(Font.Handle, SizeOf(TLogFont), @logFont);
|
||||||
|
ImmSetCompositionFontW(imc, @logFont);
|
||||||
|
if (aImc = 0) then
|
||||||
|
ImmReleaseContext(Handle, imc);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
(*
|
||||||
procedure TCustomSynEdit.WMImeComposition(var Msg: TMessage);
|
procedure TCustomSynEdit.WMImeComposition(var Msg: TMessage);
|
||||||
var
|
var
|
||||||
imc: HIMC;
|
imc: HIMC;
|
||||||
@ -2539,26 +2584,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage);
|
procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage);
|
||||||
var
|
var
|
||||||
imc: HIMC;
|
imc: HIMC;
|
||||||
logFont: TLogFont;
|
logFont: TLogFont;
|
||||||
begin
|
begin
|
||||||
with Msg do begin
|
debugln(['TCustomSynEdit.WMImeNotify ', dbgHex(Msg.lParam), ' , ', dbgHex(Msg.wParam)]);
|
||||||
case WParam of
|
|
||||||
IMN_SETOPENSTATUS:
|
case Msg.WParam of
|
||||||
begin
|
IMN_SETOPENSTATUS: begin
|
||||||
imc := ImmGetContext(Handle);
|
imc := ImmGetContext(Handle);
|
||||||
if (imc <> 0) then begin
|
if (imc <> 0) then begin
|
||||||
GetObject(Font.Handle, SizeOf(TLogFont), @logFont);
|
UpdateImeWinFont(imc);
|
||||||
ImmSetCompositionFont(imc, @logFont);
|
UpdateImeWinXY(CaretXPix, CaretYPix, imc, True);
|
||||||
|
|
||||||
ImmReleaseContext(Handle, imc);
|
ImmReleaseContext(Handle, imc);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -4249,11 +4293,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.UpdateCaret(IgnorePaintLock: Boolean = False);
|
procedure TCustomSynEdit.UpdateCaret(IgnorePaintLock: Boolean = False);
|
||||||
{$IFDEF WinIME}
|
|
||||||
var
|
var
|
||||||
cf: CompositionForm;
|
x, y: Integer;
|
||||||
imc: HIMC;
|
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
if ( (PaintLock <> 0) and not IgnorePaintLock ) or (not HandleAllocated)
|
if ( (PaintLock <> 0) and not IgnorePaintLock ) or (not HandleAllocated)
|
||||||
then begin
|
then begin
|
||||||
@ -4263,17 +4304,12 @@ begin
|
|||||||
if eoAlwaysVisibleCaret in fOptions2 then
|
if eoAlwaysVisibleCaret in fOptions2 then
|
||||||
MoveCaretToVisibleArea;
|
MoveCaretToVisibleArea;
|
||||||
|
|
||||||
FScreenCaret.DisplayPos := Point(CaretXPix, CaretYPix);
|
x := CaretXPix;
|
||||||
|
y := CaretYPix;
|
||||||
{$IFDEF WinIME}
|
FScreenCaret.DisplayPos := Point(x, y);
|
||||||
if HandleAllocated then begin
|
{$IFDEF WinIME}
|
||||||
cf.dwStyle := CFS_POINT;
|
UpdateImeWinXY(x, y);
|
||||||
cf.ptCurrentPos := Point(CaretXPix, CaretYPix);
|
{$ENDIF}
|
||||||
imc := ImmGetContext(TWinControl(Owner).Handle);
|
|
||||||
ImmSetCompositionWindow(imc, @cf);
|
|
||||||
ImmReleaseContext(TWinControl(Owner).Handle, imc);
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7555,6 +7591,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
UpdateScrollBars;
|
UpdateScrollBars;
|
||||||
|
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
UpdateImeWinFont;
|
||||||
|
{$ENDIF}
|
||||||
//debugln('TCustomSynEdit.RecalcCharExtent UseUTF8=',dbgs(UseUTF8),' Font.CanUTF8=',dbgs(Font.CanUTF8));
|
//debugln('TCustomSynEdit.RecalcCharExtent UseUTF8=',dbgs(UseUTF8),' Font.CanUTF8=',dbgs(Font.CanUTF8));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2184,6 +2184,13 @@ begin
|
|||||||
Assigned(Win32WidgetSet.FOnAsyncSocketMsg) then
|
Assigned(Win32WidgetSet.FOnAsyncSocketMsg) then
|
||||||
Exit(Win32WidgetSet.FOnAsyncSocketMsg(WParam, LParam))
|
Exit(Win32WidgetSet.FOnAsyncSocketMsg(WParam, LParam))
|
||||||
end;
|
end;
|
||||||
|
WM_IME_NOTIFY:
|
||||||
|
begin
|
||||||
|
LMessage.Msg := Msg;
|
||||||
|
LMessage.WParam := WParam;
|
||||||
|
LMessage.LParam := LParam;
|
||||||
|
//WinProcess := False;
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
// pass along user defined messages
|
// pass along user defined messages
|
||||||
if Msg >= WM_USER then
|
if Msg >= WM_USER then
|
||||||
|
Loading…
Reference in New Issue
Block a user