From a89d92ad426de091503b39acb6c4a0743a3d7e55 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Wed, 14 Sep 2022 16:39:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浼樺寲浠g爜 --- designer/utslcodeformat.tsf | 66 ++-------------------------- designer/utslsynmemo.tsf | 13 +++++- funcext/tvclib/ugtkinterface.tsf | 8 ++++ funcext/tvclib/utslvclauxiliary.tsf | 67 +++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 64 deletions(-) diff --git a/designer/utslcodeformat.tsf b/designer/utslcodeformat.tsf index 762a220..44d606d 100644 --- a/designer/utslcodeformat.tsf +++ b/designer/utslcodeformat.tsf @@ -1,9 +1,11 @@ unit UTslCodeFormat; interface +uses utslvclauxiliary; //TSL代码格式化 code 为代码,tabwidth 为缩进空格数 LineWordCount 为单行最大的词数目 linelength 字符最多个数 //20210311 美化了函数定义换行的问题 //20210406 LineWordCount linelength 两个参数已经不起作用 //20210308 添加 ABComment 参数,控制块注释的行首缩进 +//20220914 移动tire树到 utslvclauxiliary function FormatTsl(Code,tabwidth,LineWordCount,linelength,arraytype,ABComment); type TTslFParser = class(TFormatParser) function Create(); @@ -1460,69 +1462,7 @@ Type TTK = class FTypeSub := st ; end end -type TTire = class - type TTireNode = class - FChar; - FSub; - FEnd; - function Create(v); - begin - FChar := v; - FSub := array(); - FEnd := false; - end - function Add(s); - begin - v0 := s[1]; - vsub := FSub[v0]; - if not vsub then - begin - vsub := new TTireNode(v0); - FSub[v0] := vsub; - end - ls := length(s); - if ls>1 then - vsub.Add(s[2:]); - else - begin - vsub.FEnd := true; - end - end - function Find(s,slen,idx); - begin - if idx>slen then return FEnd; - v0 := s[idx]; - vsub := FSub[v0]; - if vsub then - begin - idx++; - return vsub.Find(s,slen,idx); - end - return FEnd ; - end - end - function Add(s); - begin - FRoot.Add(s); - end - function Create(); - begin - FRoot := new TTireNode(); - end - function Find(s,slen,idx,outidx,ostr); - begin - tid := idx; - r := FRoot.Find(s,slen,idx); - if r then - begin - ostr := s[tid:idx-1]; - outidx := idx; - end - idx := tid; - return r; - end - FRoot; -end + Type TStateStack = class function Create(); begin diff --git a/designer/utslsynmemo.tsf b/designer/utslsynmemo.tsf index 95d8132..b6e3cfb 100644 --- a/designer/utslsynmemo.tsf +++ b/designer/utslsynmemo.tsf @@ -310,6 +310,7 @@ type TTslSynHighLighter = class(TSynHighLighter) begin idx := max(1,idx); if not(FChangeDeal) and idx>FSatesCount then return ; + fdolastline := idx-2; if length(FSates)>=idx then FSatesCount := idx; else FSatesCount := length(FSates)-1; @@ -975,7 +976,8 @@ type TTslSynHighLighter = class(TSynHighLighter) FChangeDeal := true; {setprofiler(7); t := now();} - mtic; + if fdolastline>=LastLine then return ; + fdolastline := LastLine; for i:= FSatesCount-1 to LastLine do begin if i<0 then continue; @@ -1114,6 +1116,7 @@ type TTslSynHighLighter = class(TSynHighLighter) static FJsHtmlEvent; static FCssPropertys; private + fdolastline; FChangeDeal; //语言分支 FSynBranch; @@ -1256,6 +1259,7 @@ type TJsonSynHighLighter = class(TSynHighLighter) begin idx := max(1,idx); if not(FChangeDeal) and idx>FSatesCount then return ; + fdolastline := idx-2; if length(FSates)>=idx then FSatesCount := idx; else FSatesCount := length(FSates)-1; @@ -1342,6 +1346,8 @@ label L_XCDG; begin ls := Lines; FChangeDeal := true; + if fdolastline>=LastLine then return ; + fdolastline := LastLine; for i:= FSatesCount-1 to LastLine do begin if i<0 then continue; @@ -1456,6 +1462,7 @@ label L_XCDG; end private + fdolastline; FTokens; FSates; FSatesCount; @@ -1496,6 +1503,7 @@ type ttfmhighlighter = class(TSynHighLighter) begin idx := max(1,idx); if not(FChangeDeal) and idx>FSatesCount then return ; + fdolastline := idx-2; if length(FSates)>=idx then FSatesCount := idx; else FSatesCount := length(FSates)-1; @@ -1587,6 +1595,8 @@ label L_XCDG; begin ls := Lines; FChangeDeal := true; + if fdolastline>=LastLine then return ; + fdolastline := LastLine; for i:= FSatesCount-1 to LastLine do begin if i<0 then continue; @@ -1727,6 +1737,7 @@ label L_XCDG; end private + fdolastline; FTokens; FSates; FSatesCount; diff --git a/funcext/tvclib/ugtkinterface.tsf b/funcext/tvclib/ugtkinterface.tsf index f2e7f84..6670cf0 100644 --- a/funcext/tvclib/ugtkinterface.tsf +++ b/funcext/tvclib/ugtkinterface.tsf @@ -31,6 +31,14 @@ type tsgtkapi = class(tgtkapis) function shell32DllGetVersion(); begin end + function GetSystemMetrics(idx); + begin + global g_w_c_width; + case idx of + 0x4 : return g_w_c_width; + end ; + return 24; + end function GetCursorInfo_(); begin end diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index 05611b6..40a5566 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -2,6 +2,7 @@ unit utslvclauxiliary; {** @explan(说明) tslvcl 辅助库 %% **} +//20220914 移入tire树 interface function includestate(u,s); function excludestate(u,s); @@ -1628,6 +1629,72 @@ type TNode = class() return FItems.Count; end end +type TTire = class +{** + @explan(说明) tire树 +**} + type TTireNode = class + FChar; + FSub; + FEnd; + function Create(v); + begin + FChar := v; + FSub := array(); + FEnd := false; + end + function Add(s); + begin + v0 := s[1]; + vsub := FSub[v0]; + if not vsub then + begin + vsub := new TTireNode(v0); + FSub[v0] := vsub; + end + ls := length(s); + if ls>1 then + vsub.Add(s[2:]); + else + begin + vsub.FEnd := true; + end + end + function Find(s,slen,idx); + begin + if idx>slen then return FEnd; + v0 := s[idx]; + vsub := FSub[v0]; + if vsub then + begin + idx++; + return vsub.Find(s,slen,idx); + end + return FEnd ; + end + end + function Add(s); + begin + FRoot.Add(s); + end + function Create(); + begin + FRoot := new TTireNode(); + end + function Find(s,slen,idx,outidx,ostr); + begin + tid := idx; + r := FRoot.Find(s,slen,idx); + if r then + begin + ostr := s[tid:idx-1]; + outidx := idx; + end + idx := tid; + return r; + end + FRoot; +end implementation function includestate(u,s); begin