界面库

将输入法相关代码已入到底层库
This commit is contained in:
JianjunLiu 2023-05-11 14:42:09 +08:00
parent 6f0bb71708
commit 759e06ea4a
4 changed files with 61 additions and 57 deletions

View File

@ -64,7 +64,6 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
FChangedFlag := false;
FChangedLock := false;
Lineinterval := 3;
FCOMPOSITIONFORM := new tagCOMPOSITIONFORM(nil);
font := array("height":18,"width":9,"escapement":0,"orientation":0,"weight":400,"italic":0,"underline":0,"strikeout":0,
"charset":0,"outprecision":0,"clipprecision":0,"quality":1,"pitchandfamily":1,"facename":"Courier New","color":0);
//134
@ -79,33 +78,6 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
if HandleAllocated()then calldatafunction(FOnCaretChanged,self(true),new tuieventbase(0,0,0,0));
//echo tostn(self.CaretXY);
end
function WMIMESTARTCOMPOSITION(o,e):WM_IME_STARTCOMPOSITION;virtual;
begin
ime := ImmGetContext(self.Handle);
FCOMPOSITIONFORM.ptcurrentpos.cx := 200;
FCOMPOSITIONFORM.ptcurrentpos.cy := 200;
ImmSetCompositionWindow(ime,FCOMPOSITIONFORM._getptr_());
ImmReleaseContext(self.Handle,ime);
end
{$ifdef linux}
function ImmReleaseContext();
begin
end;
function ImmGetContext();
begin
end;
function ImmSetCompositionWindow();
begin
end;
function ImmSetStatusWindowPos();
begin
end;
{$else}
function ImmReleaseContext(h:pointer;ime:pointer):integer;stdcall;external "Imm32.dll" name "ImmReleaseContext";
function ImmGetContext(h:pointer):pointer;stdcall;external "Imm32.dll" name "ImmGetContext";
function ImmSetCompositionWindow(h:pointer;s:pointer):integer;stdcall;external "Imm32.dll" name "ImmSetCompositionWindow";
function ImmSetStatusWindowPos(h:pointer;s:pointer):integer;stdcall;external "Imm32.dll" name "ImmSetStatusWindowPos";
{$endif}
function InvalidateLines(FirstLine,LastLine:integer);override;
begin
if not HandleAllocated()then return;
@ -306,34 +278,10 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
FOnTextChanged;
FOnTextSetFocus;
FQuckKeys;
FCOMPOSITIONFORM;
FOnCaretChanged;
end
implementation
type tagCOMPOSITIONFORM=class(tslcstructureobj)
private
static SSTRUCT;
class function getstruct()
begin
if not SSTRUCT then SSTRUCT := MemoryAlignmentCalculate(array(
("dwstyle","int",4),
("ptcurrentpos","intptr",0),
("rcarea","int[4]",array(0,0,0,0))),nil,nil,1);
return SSTRUCT;
end
public
function create()
begin
inherited create(getstruct(),ptr);
FPonter := new TCPoint();
_setvalue_("ptcurrentpos",FPonter._getptr_());
end
property dwstyle index "dwstyle" read _getvalue_ write _setvalue_;
property ptcurrentpos read FPonter;
property rcarea index "rcarea" read _getvalue_ write _setvalue_;
private
FPonter;
end
type TTslDebuga=class(TCustomControl)
private //³ÉÔ±±äÁ¿
frunbtncall;

View File

@ -7,7 +7,7 @@ unit UTslMemo;
{$define linuxpop}
{$endif}
interface
uses utslvclauxiliary,utslvclgdi,utslvclstdctl;
uses utslvclauxiliary,utslvclmemstruct,utslvclgdi,utslvclstdctl;
type TMemoLineItem=class() //编辑字符串行对象
function Create(s);
begin
@ -3931,6 +3931,7 @@ type TSynCustomMemo = class(TCustomMemo)
function Create(AOwner);//构造
begin
inherited;
FCOMPOSITIONFORM := new tagCOMPOSITIONFORM(nil);
FTabChar := " ";
end
function Recycling();override; //回收
@ -4048,7 +4049,37 @@ type TSynCustomMemo = class(TCustomMemo)
property Highlighter:thighlighter read FHighlighter write SetHighlighter; //语法高亮
property Completion read FCompletion write SetCompletion; //自动完成
property TabChar read FTabChar write SetTabChar;
public //ÊäÈë·¨Ïà¹Ø
function WMIMESTARTCOMPOSITION(o,e):WM_IME_STARTCOMPOSITION;virtual;
begin
ime := ImmGetContext(self.Handle);
FCOMPOSITIONFORM.ptcurrentpos.cx := 200;
FCOMPOSITIONFORM.ptcurrentpos.cy := 200;
ImmSetCompositionWindow(ime,FCOMPOSITIONFORM._getptr_());
ImmReleaseContext(self.Handle,ime);
end
{$ifdef linux}
function ImmReleaseContext();
begin
end;
function ImmGetContext();
begin
end;
function ImmSetCompositionWindow();
begin
end;
function ImmSetStatusWindowPos();
begin
end;
{$else}
function ImmReleaseContext(h:pointer;ime:pointer):integer;stdcall;external "Imm32.dll" name "ImmReleaseContext";
function ImmGetContext(h:pointer):pointer;stdcall;external "Imm32.dll" name "ImmGetContext";
function ImmSetCompositionWindow(h:pointer;s:pointer):integer;stdcall;external "Imm32.dll" name "ImmSetCompositionWindow";
function ImmSetStatusWindowPos(h:pointer;s:pointer):integer;stdcall;external "Imm32.dll" name "ImmSetStatusWindowPos";
{$endif}
private
FCOMPOSITIONFORM;
FHighlighter;
FCompletion;
FTabChar;
@ -4305,6 +4336,7 @@ type TSynMemoNorm = class(TsynCustomMemo) //
FSheetTabFlage;
end
Implementation
function CreateATslMemoUndoItem(AReason,AStart,AEnd,ChangeText,SelMode);
begin
return new TTslMemoUndoItem(AReason,AStart,AEnd,ChangeText,SelMode);

View File

@ -1412,6 +1412,30 @@ type Ttagmoduleentry32=class(tslcstructureobj)
property szmodule index "szmodule" read _getvalue_ write _setvalue_;
property szexepath index "szexepath" read _getvalue_ write _setvalue_;
end
type tagCOMPOSITIONFORM=class(tslcstructureobj)
private
static SSTRUCT;
class function getstruct()
begin
if not SSTRUCT then SSTRUCT := MemoryAlignmentCalculate(array(
("dwstyle","int",4),
("ptcurrentpos","intptr",0),
("rcarea","int[4]",array(0,0,0,0))),nil,nil,1);
return SSTRUCT;
end
public
function create()
begin
inherited create(getstruct(),ptr);
FPonter := new TCPoint();
_setvalue_("ptcurrentpos",FPonter._getptr_());
end
property dwstyle index "dwstyle" read _getvalue_ write _setvalue_;
property ptcurrentpos read FPonter;
property rcarea index "rcarea" read _getvalue_ write _setvalue_;
private
FPonter;
end
implementation
(*

View File

@ -4059,12 +4059,12 @@ type TCustomComboBoxbase=class(TCustomControl)
if csDesigning in ComponentState then return;
x := e.xpos;
y := e.ypos;
if x>1 and y>1 then return ShowDropDown(true);
return ;
//if x>1 and y>1 then return ShowDropDown(true);
if x>FBtnRect[0]and x<FBtnRect[2]and y>FBtnRect[1]and y<FBtnRect[3]then
begin
ShowDropDown(true);
return ShowDropDown(true);
end
return ;
end
function ShowDropDown(flg);
begin