From c3e7ddbc9f5b2de32cbd6b524dbd90f296948fd5 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Tue, 11 Apr 2023 14:17:07 +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 颜色自定义优化 --- designer/utslcodeeditor.tsf | 14 ++++----- designer/utslsynmemo.tsf | 59 +++++++++++++++++++++++++++---------- designer/utslvcldebuger.tsf | 13 +++++++- funcext/tvclib/utslmemo.tsf | 25 +++++++++++++--- 4 files changed, 84 insertions(+), 27 deletions(-) diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index 8b8d99d..0e3b9da 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -4247,10 +4247,10 @@ type TEditer=class(TCustomcontrol) // if ifobj(c[0])and ifobj(c[1])then begin h := CreateObject(c[0],ow);//Fhightercolor; - if n="tsl" then - begin + //if n="tsl" then + // begin h.hightercolor := Fhightercolor; - end + //end return array(h,CreateObject(c[1],ow)); end end @@ -4545,9 +4545,9 @@ type thighlightercoloredter=class(tvcform) openfileadlg1:topenfileadlg; function Create(AOwner);override; //¹¹Ôì begin - fcolorindexname := array("×ÖÌå","¹Ø¼ü×Ö","·ûºÅ","×¢ÊÍ","×Ö·û´®","Êý×Ö","ϵͳº¯Êý","Ñ¡Öб³¾°","µ±Ç°Ðб³¾°"); - ffrontcolordefault := array(0,0x0000ff,0,0x228B22,0x8B008B,0x666666,0xcd0000,0,0); - fbkcolordefalut := zeros(7)+0xfafafa union array(rgb(192,192,192),rgb(232,232,255)); + fcolorindexname := array("×ÖÌå","¹Ø¼ü×Ö","·ûºÅ","×¢ÊÍ","×Ö·û´®","Êý×Ö","ϵͳº¯Êý","Ñ¡Öб³¾°","µ±Ç°Ðб³¾°","Ðкű³¾°"); + ffrontcolordefault := array(0,0x0000ff,0,0x228B22,0x8B008B,0x666666,0xcd0000,0,0,0); + fbkcolordefalut := zeros(7)+0xfafafa union array(rgb(192,192,192),rgb(232,232,255),rgb(228,228,228)); ffrontcolors := ffrontcolordefault; fbkcols := fbkcolordefalut; inherited; @@ -4592,7 +4592,7 @@ type thighlightercoloredter=class(tvcform) begin if flistboxchanging then return ; idx := listbox1.ItemIndex; - if idx in array(0,7,8) then + if idx in array(0,7,8,9) then begin cl := colorcombobox2.getcurrentColor(); fbkcols[idx] := cl; diff --git a/designer/utslsynmemo.tsf b/designer/utslsynmemo.tsf index ff4d442..ffc3f4e 100644 --- a/designer/utslsynmemo.tsf +++ b/designer/utslsynmemo.tsf @@ -10,6 +10,10 @@ type thighlitcolor = class(tcomponent) inherited; intitcolors(); end + function gutterbkcolor(); + begin + return FColors["Ðкű³¾°"]; + end function selbkcolor(); begin return FColors["Ñ¡Öб³¾°"]; @@ -62,7 +66,8 @@ type thighlitcolor = class(tcomponent) array("×ÖÌå": ("font":0,"back":16448250),"¹Ø¼ü×Ö": ("font":255,"back":16448250),"·ûºÅ": - ("font":0,"back":16448250),"×¢ÊÍ": + ("font":255,"back":16448250),"Ðкű³¾°": + ("font":0,"back":15000804),"×¢ÊÍ": ("font":2263842,"back":16448250),"×Ö·û´®": ("font":9109643,"back":16448250),"Êý×Ö": ("font":6710886,"back":16448250),"ϵͳº¯Êý": @@ -74,7 +79,7 @@ type thighlitcolor = class(tcomponent) begin FColors["back"] := new tcolor(v["back"]); end - if i in array("Ñ¡Öб³¾°","µ±Ç°Ðб³¾°") then + if i in array("Ñ¡Öб³¾°","µ±Ç°Ðб³¾°","Ðкű³¾°") then begin FColors[i] := new tcolor(v["back"]); end else @@ -103,7 +108,7 @@ type thighlitcolor = class(tcomponent) end else begin v.changed := false; - if i in array("Ñ¡Öб³¾°","µ±Ç°Ðб³¾°") then + if i in array("Ñ¡Öб³¾°","µ±Ç°Ðб³¾°","Ðкű³¾°") then begin v.color := transblk(cls[i]["back"]); end else @@ -121,6 +126,10 @@ type thighlitcolor = class(tcomponent) if i= "µ±Ç°Ðб³¾°" then begin cgd .|= 16; + end else + if i="Ðкű³¾°" then + begin + cgd .|= 32; end else cgd .|= 1; end @@ -362,7 +371,6 @@ type TTslSynHighLighter = class(TSynHighLighter) private fpairbegin; public - hightercolor; fforcehtml; function forcehtml(h); begin @@ -470,11 +478,14 @@ type TTslSynHighLighter = class(TSynHighLighter) case tp of '//','/*': begin - d.FFColor := 0x8D9600; + if hightercolor then d.FFcolor := hightercolor.commentcolor() ; + else + d.FFColor := 0x8D9600; end '"',"'": - begin - d.FFColor := 0x968080; + begin + if hightercolor then d.FFcolor := hightercolor.strcolor() ; + else d.FFcolor := 0x968080; end "{": begin @@ -516,23 +527,33 @@ type TTslSynHighLighter = class(TSynHighLighter) begin if FJsWindows[bttk] then // begin - d.FFColor := 0xFF0000; + if hightercolor then d.FFcolor := hightercolor.sysfunccolor() ; + else + d.FFColor := 0xFF0000; end else if FJsKeyWords[bttk] then // FE0064 begin - d.FFColor := 0xFF0000; + if hightercolor then d.FFcolor := hightercolor.keycolor() ; + else + d.FFColor := 0xFF0000; end else if FJsSysClass[bttk] then // begin - d.FFColor := 0xFF0000; + if hightercolor then d.FFcolor := hightercolor.keycolor() ; + else + d.FFcolor := 0xcd0000; end else if FJsHtmlEvent[bttk] then // begin - d.FFColor := 0xFF0000; + if hightercolor then d.FFcolor := hightercolor.sysfunccolor() ; + else + d.FFColor := 0xFF0000; end else if FCssPropertys[bttk] then begin - d.FFColor := 0x0000FF; + if hightercolor then d.FFcolor := hightercolor.keycolor() ; + else + d.FFColor := 0x0000FF; end end @@ -1440,16 +1461,24 @@ type TxmlSynHighLighter = class(tcustomsynhighlighter) if st1=1 and st.state=1 then begin st.subitemadd(); + if st.subitemcount()>1 then + begin + + + end else + begin + + end case d.FFColor of stringcolor,symcolor: begin end else begin - if st.subitemcount()>1 then + if st.subitemcount()>1 then begin - d.FFColor := 0x0000ff; + d.FFColor := keywordcolor;// 0x0000ff; end else - d.FFColor := 0xff0000; + d.FFColor := sysfuncolor; end end diff --git a/designer/utslvcldebuger.tsf b/designer/utslvcldebuger.tsf index b2e7966..dea1fd6 100644 --- a/designer/utslvcldebuger.tsf +++ b/designer/utslvcldebuger.tsf @@ -23,7 +23,8 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm) setbkc(hc.bkcolor().color); setfc(hc.fontcolor().color); setselbc(hc.selbkcolor().color); - curbc(hc.curbkcolor().color); + curbc(hc.curbkcolor().color); + setgutter(hc.gutterbkcolor().color); end end function setselbc(bc); @@ -31,6 +32,12 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm) if bc>0 then selectbkcolor := bc; else selectbkcolor := rgb(192,192,192); end + function setgutter(bc); + begin + if bc>0 then guttercolor := bc; + else guttercolor := rgb(228,228,288); + + end function curbc(bc); begin if bc>0 then currentLineColor := bc; @@ -256,6 +263,10 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm) begin curbc(a.curbkcolor().color); end + if op["value"] .& 32 then + begin + setgutter(a.gutterbkcolor().color); + end return ; end inherited; diff --git a/funcext/tvclib/utslmemo.tsf b/funcext/tvclib/utslmemo.tsf index d6b76f1..1896b51 100644 --- a/funcext/tvclib/utslmemo.tsf +++ b/funcext/tvclib/utslmemo.tsf @@ -779,7 +779,13 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) // function PaintGutter(rcDraw,nL1,nL2); begin dc := Canvas; - dc.brush.Color :=FGutterColor ;//rgb(228,228,228); + if ifnumber(FGutterColor) then + begin + c := FGutterColor; + end else + if ifobj(FGutterColor) then c := FGutterColor.color; + else c := rgb(228,228,228); + dc.brush.Color :=c ;//rgb(228,228,228); rc := rcDraw; rc[2]-= 6; dc.FillRect(rc); @@ -1783,7 +1789,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) // end function setguttercolor(c); begin - if ifnumber(c) and c<>fguttercolor then + if ifnumber(c) and c<>fguttercolor then begin fguttercolor := c; InvalidateRect(nil,false); @@ -1791,7 +1797,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) // end function setselectbkcolor(c); begin - if ifnumber(c) and c<>fselectbkcolor then + if c<>fselectbkcolor then begin fselectbkcolor := c; b1 := BlockBegin; @@ -2993,7 +2999,9 @@ type TSynCompletion = class(TSynCompletionList) end end end -type TSynHighLighter = class(TComponent) //Óï·¨¸ßÁÁÀàÐÍ +type TSynHighLighter = class(TComponent) //Óï·¨¸ßÁÁÀàÐÍ + public + hightercolor; type thtcolor = class() function create(cl); begin @@ -3262,6 +3270,15 @@ type tcustomsynhighlighter = class(TSynHighLighter) FChangeDeal := true; if fdolastline>=LastLine then return ; fdolastline := LastLine; + if hightercolor then + begin + fsymcolor := hightercolor.symcolor(); + fnumbercolor := hightercolor.numcolor(); + fkeywordcolor := hightercolor.keycolor(); + fsysfuncolor := hightercolor.sysfunccolor(); + fstringcolor := hightercolor.strcolor(); + fannotationcolor := hightercolor.commentcolor(); + end for i := FSatesCount-1 to LastLine do begin if i<0 then continue;