From c924bcd2a0a3a92af43496b8ef01360820b0dff7 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Wed, 8 Mar 2023 09:30:52 +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 css鏀寔 --- designer/utslcodeeditor.tsf | 14 ++--- designer/utslsynmemo.tsf | 90 ++++++++++++++++++++++++----- funcext/tvclib/utslvclstdctl.tsf | 2 +- funcext/tvclib/uvclthreadworker.tsf | 22 ++++--- 4 files changed, 99 insertions(+), 29 deletions(-) diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index 7476d5c..f279f12 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -1832,6 +1832,7 @@ type TEditer=class(TCustomcontrol) // FSynClasses["tsl"]:= array(class(TTslSynHighLighter),class(TTslCompletion),";tsl;tsf;pas;stm;"); FSynClasses["json"]:= array(class(TJsonSynHighLighter),class(TSynCompletion),";json;"); FSynClasses["js"]:= array(class(TJsSynHighLighter),class(tjssyncompletion),";js;"); + FSynClasses["css"]:= array(class(TcssSynHighLighter),class(tcsssyncompletion),";css;"); FSynClasses["ini"]:= array(class(TINISynHigLighter),class(TSynCompletion),";ini;"); FSynClasses["bat"]:= array(class(TBatSynHigLighter),class(TSynCompletion),";bat;cmd;"); FSynClasses["tfm"]:= array(class(ttfmhighlighter),class(TSynCompletion),";tfm;"); @@ -3634,9 +3635,9 @@ type TEditer=class(TCustomcontrol) // function FindInCurrent(data,fo,it,rep); begin if not it then it := GetCurrentItem(); - if not it then return-2; + if not it then return -2; ed := it.FEditer; - if not ed then return-2; + if not ed then return -2; cy := ed.CaretY; cx := ed.CaretX; wordwrap := data["c_wrap"]; @@ -3644,7 +3645,7 @@ type TEditer=class(TCustomcontrol) // if not(fs and ifstring(fs))then begin fo.SetStatusText("查找内容为空!"); - return-2; + return -2; end stringiswrapword := isCaseWords(fs); if data["c_case"]then fs := lowercase(fs); @@ -3664,7 +3665,7 @@ type TEditer=class(TCustomcontrol) // if ridx<0 then begin fo.SetStatusText("到达顶部"); - return-2; + return -2; end s := L.GetStringByIndex(ridx); ls := length(s); @@ -3704,7 +3705,7 @@ type TEditer=class(TCustomcontrol) // cx := length(s)+1; end fo.SetStatusText("到达顶部"); - return-2; + return -2; end for i := 0 to ct do begin @@ -5467,8 +5468,7 @@ end function gettslexe(); begin return static gettslexefullpath(); -end - +end {$ifdef linux} function HtmlHelpA() begin diff --git a/designer/utslsynmemo.tsf b/designer/utslsynmemo.tsf index 3f32790..39e0f99 100644 --- a/designer/utslsynmemo.tsf +++ b/designer/utslsynmemo.tsf @@ -129,6 +129,53 @@ type thighlitcolor = class(tcomponent) end FColors; end +type tcsssyncompletion = class(TSynCompletion) + function Create(AOwner); + begin + inherited; + IgnoreCase := false; + end + function PrepareCompletion(m);override; + begin + //解析 + if not Memo then return ; + sd := static getcsswordsa(); + d := gettextwords(Memo.Text); + if d then sd union=d; + SetCompData(sd); + end + function getcsswordsa(); + begin + getcsskeywords(r); + return r; + end + function gettextwords(s); + begin + parseregexpr("[A-Zaz0-9_\\-]+",s,"mi",mched,mchpos,mathlen); + r := array(); + for ri,v in mched do + begin + v0 := v[0]; + lv := lowercase(v0); + if r[lv] then continue; + r[lv] := v0; + end + d := array(); + i := 0; + for lv,v in r do + begin + d[i,"caption"] := v; + d[i,"value"] := v; + d[i,"lvalue"] := lv; + cl := length(v); + d[i,"clen"] := cl; + d[i,"vlen"] := cl; + i++; + end + return d; + end + +end type tjssyncompletion = class(TSynCompletion) function Create(AOwner); begin @@ -343,20 +390,17 @@ type TTslSynHighLighter = class(TSynHighLighter) FJsSysClass[v]:=true; end FJsWindows := array(); - for i,v in array("$","alert","all","anchor","anchors","area","assign","blur","button","checkbox","clearInterval","clearTimeout","clientInformation","close","closed","confirm","constructor","crypto","decodeURI","decodeURIComponent","defaultStatus","document","element","elements","embed","embeds","encodeURI","encodeURIComponent","escape","event","fileUpload","focus","form","forms","frame","innerHeight","innerWidth","layer","layers","link","location","mimeTypes","navigate","navigator","frames","frameRate","hidden","history","image","images","offscreenBuffering","open","opener","option","outerHeight","outerWidth","packages","pageXOffset","pageYOffset","parent","parseFloat","parseInt","password","pkcs11","plugin","prompt","propertyIsEnum","radio","reset","screenX","screenY","scroll","secure","select","self","setInterval","setTimeout","status","submit","taint","text","textarea","top","unescape","untaint","window") - do + for i,v in getjsfunwords() do begin FJsWindows[v]:=true; end FJsHtmlEvent := array(); - for i,v in array("onblur","onclick","onerror","onfocus","onkeydown","onkeypress","onkeyup","onmouseover","onload","onmouseup","onmousedown","onsubmit") - do + for i,v in getdomeventwords() do begin FJsHtmlEvent[v]:=true; end FCssPropertys := array(); - for i,v in array("align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","caption-side","clear","clip","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-face","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","grid-columns","grid-rows","hanging-punctuation","height","icon","justify-content","keyframes","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","max-height","max-width","media","min-height","min-width","mix-blend-mode","object-fit","object-position","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","position","punctuation-trim","quotes","resize","right","rotation","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-transform","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","white-space","width","word-break","word-spacing","word-wrap","z-index","writing-mode") - do + for i,v in getcsswords() do begin FCssPropertys[v]:=true; end @@ -1369,7 +1413,24 @@ type TJsSynHighLighter = class(tcustomsynhighlighter) return getjsclasswords() union2 getjsfunwords(); end -end +end +type TcssSynHighLighter = class(tcustomsynhighlighter) + function create(AOwner); + begin + inherited; + keywordcolor := 0xff0000; + stringcolor := 0x968080; + annotationcolor := 0x8D9600; + ExecuteCommand("string",array(('"',"\\"))); + ExecuteCommand("keywords",getcsswords()); + ExecuteCommand("rowannotes",array()); + ExecuteCommand("blockannotes",array(("/*","*/"))); + ExecuteCommand("syms",array("{","}","[","]","<",">","(",")",";",":",",","=","?","+","*","/",".","#")); + ExecuteCommand("pairs",array(("{","}"),("[","]"),("(",")"))); + ExecuteCommand("sysfun",array()); + end +end + type ttfmhighlighter = class(tcustomsynhighlighter) function create(AOwner); @@ -1386,11 +1447,9 @@ type ttfmhighlighter = class(tcustomsynhighlighter) end implementation -function getcsskeywords(r); +function getcsswords(); begin - if not ifarray(r) then r := array(); - idx := length(r); - for i,v in array("align-content","align-items","align-self","all","animation","animation-delay", + return array("align-content","align-items","align-self","all","animation","animation-delay", "animation-direction","animation-duration","animation-fill-mode","animation-iteration-count", "animation-name","animation-play-state","animation-timing-function","appearance","backface-visibility", "background","background-attachment","background-blend-mode","background-clip","background-color", @@ -1417,8 +1476,13 @@ begin "text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-justify", "text-outline","text-overflow","text-shadow","text-transform","text-wrap","top","transform","transform-origin","transform-style", "transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align", - "visibility","white-space","width","word-break","word-spacing","word-wrap","z-index","writing-mode") - do + "visibility","white-space","width","word-break","word-spacing","word-wrap","z-index","writing-mode"); +end +function getcsskeywords(r); +begin + if not ifarray(r) then r := array(); + idx := length(r); + for i,v in getcsswords()do begin c := v+" "; r[idx]["caption"] := c; diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index 5843eb8..4b9bcb0 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -141,7 +141,7 @@ type TCustomTimer = class(tcomponent)// tm.stop();//停止 **} private - static _STIMERS; //TIMER对象 + [weakref] static _STIMERS; //TIMER对象 static FSIDC; //id 构造器 class function Sgettimer(id); begin diff --git a/funcext/tvclib/uvclthreadworker.tsf b/funcext/tvclib/uvclthreadworker.tsf index 5302616..a47c206 100644 --- a/funcext/tvclib/uvclthreadworker.tsf +++ b/funcext/tvclib/uvclthreadworker.tsf @@ -99,7 +99,14 @@ type TCustomThreadworker = class() for idx,i in mrows( FThreaders,1) do begin o := FThreaders[i]; - if uifeachthreadworkerdata(o.handle,msg,data) then + try + oh := o.handle; + except + echo ">>>>>>>>>>>>>"; + DeleteWorker(i); + uideleteworkerdata(oh); //删除数据 + end + if uifeachthreadworkerdata(oh,msg,data) then begin case msg of 0x30: //构成成功 @@ -112,7 +119,7 @@ type TCustomThreadworker = class() end 0x12: //成功关闭 begin - uideleteworkerdata(o.handle); //删除数据 + uideleteworkerdata(oh); //删除数据 o.ClientReady(0); DeleteWorker(i); o.destroy(); @@ -204,7 +211,7 @@ type TCustomThreadworker = class() function SetOnStart(e)begin FThreader.OnStart := e ; end - static FThreaders; + [weakref]static FThreaders; FScript; //脚本 FThreader;//host对象 end @@ -230,7 +237,7 @@ begin uisetthreadworkerdata(ph,0x12,0); //关闭完成 uideleteworkerdata(h); //删除消息 return; - end + end 0x20 : //post begin this.DoOnMessage(d); @@ -282,10 +289,10 @@ type tworkerHost = class(TArray) function close(); //关闭命令 0x10 begin if FConnectHandle then - begin + begin uisetthreadworkerdata(FConnectHandle,0x11,0); end - end + end function ClientReady(h); //任务句柄改变 begin FConnectHandle := h; @@ -294,8 +301,7 @@ type tworkerHost = class(TArray) if iffuncptr(FOnStart) then begin try - call(FOnStart,self); - + call(FOnStart,self); except end;