diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index e4155fb..1da30f3 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -1811,6 +1811,7 @@ type TEditer=class(TCustomcontrol) // FSynClasses["json"]:= array(class(TJsonSynHighLighter),class(TSynCompletion),";json;"); 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;"); FSynClasses["None"]:= array(nil,nil,""); //FSynClasses["tsf"] := FSynClasses["tsl"]; FTslChmHelp := new TTslChmHelp(); diff --git a/designer/utslsynmemo.tsf b/designer/utslsynmemo.tsf index a1517f9..95d8132 100644 --- a/designer/utslsynmemo.tsf +++ b/designer/utslsynmemo.tsf @@ -1467,6 +1467,281 @@ label L_XCDG; FBEStates; FMBStates ; end +type ttfmhighlighter = class(TSynHighLighter) + function Create(AOwner); + begin + inherited; + Clean(); + FChangeDeal := true; + end + function Clean();override; + begin + // { " + FTokens := array(); + FSates := array(0); //状态 + FBBStates := array(new TBBState(")")); + FBEStates := array(new TBBState("}")); + FMBStates := array(new TBBState("]")); + FbgedStates := array(new TBBState("end")); + FjkhStates := array(new TBBState(">")); + FSatesCount := 1; //改变的行 + end + function Recycling();override; + begin + + inherited; + Clean(); + end + function SetInValidateIndex(idx); override; //当前改变的行 + begin + idx := max(1,idx); + if not(FChangeDeal) and idx>FSatesCount then return ; + if length(FSates)>=idx then + FSatesCount := idx; + else FSatesCount := length(FSates)-1; + if FSatesCount = 1 then Clean(); + FChangeDeal := false; + end + function ParserTokenLines(s,b,e,cst,tokens); + begin +label L_XCDG; + if cst=0 then + begin + idx := b; + ttk := ""; + while idx<=e do + begin + vi := s[idx]; + case vi of + " ","\t": + begin + SetTToken(tokens,ttk,idx-1); + end + "(",")": + begin + SetTToken(tokens,ttk,idx-1); + SetTToken(tokens,vi,idx,")"); + end + "{","}": + begin + SetTToken(tokens,ttk,idx-1); + SetTToken(tokens,vi,idx,"}"); + end + "[","]": + begin + SetTToken(tokens,ttk,idx-1); + SetTToken(tokens,vi,idx,"]"); + end + "<",">": + begin + SetTToken(tokens,ttk,idx-1); + SetTToken(tokens,vi,idx,">"); + end + ":",",": + begin + SetTToken(tokens,ttk,idx-1); + SetTToken(tokens,vi,idx,vi); + end + '"': + begin + SetTToken(tokens,ttk,idx-1); + SetTToken(tokens,vi,idx,'"'); + return ParserTokenLines(s,idx+1,e,'"',tokens); + end else + begin + ttk+=vi; + end + + end ; + idx++; + end + SetTToken(tokens,ttk,idx-1); + end else //查找 + begin + if b>e then return cst; + r := FindRightChar(cst,s,b,e,"\\"); + if r=0 then //没找到 + begin + Setttoken(tokens,s[b:],e,cst); + return cst; + end else //找到 + if r<=e then + begin + if b") then d.FFColor := 0xFF0000; + if ext=">" and tk="<" then + begin + fcjkhState.GetLeft(); + d.FMATe := fcjkhState.GetSate(); + end else + if ext=">" and tk=">" then + begin + fcjkhState.GetRight(); + d.FMATe := fcjkhState.GetSate(); + end else + if ext="}" and tk="{" then + begin + FCBEState.GetLeft(); + d.FMATe := FCBEState.GetSate(); + end else + if ext="}" and tk="}" then + begin + FCBEState.GetRight(); + d.FMATe := FCBEState.GetSate(); + end else + if ext="]" and tk="[" then + begin + FCMBState.GetLeft(); + d.FMATe := FCMBState.GetSate(); + + end else + if ext="]" and tk="]" then + begin + FCMBState.GetRight(); + d.FMATe := FCMBState.GetSate(); + end else + if ext=")" and tk="(" then + begin + FCBBState.GetLeft(); + d.FMATe := FCBBState.GetSate(); + + end else + if ext=")" and tk=")" then + begin + FCBBState.GetRight(); + d.FMATe := FCBBState.GetSate(); + end else + if ext='"' then + begin + D.FFColor := 0x8B008B; + end else + if tk in array("true","false","null") then + begin + d.FFColor := 0x0000FF; + end else + if tk ="object" then + begin + d.FFColor := 0x0000FF; + fcbgesate.GetLeft(); + d.FMATe := fcbgesate.GetSate(); + end else + if tk="end" then + begin + d.FFColor := 0x0000FF; + fcbgesate.GetRight(); + d.FMATe := fcbgesate.GetSate(); + end else + if tk in array(":",",") then + begin + d.FFColor := 0x0000FF; + end else + if StrIsANumber(tk) then d.FFColor := 0x666666; + return d; + + end + private + function StrIsANumber(s); + begin + if not s then return 0; + r := (1=ParseRegExpr("^[+-]?[\\d]+",s,"",result,MPos,Mlen)) ; + return r; + end + function FindRightChar(c,s,b,e,zy); //查找封闭的字符 + begin + i := b; + while i<=e do + begin + si := s[i]; + if si=zy then + begin + i+=2; + if i>e then return 0; + continue; + end + if s[i]=c then //找到了 + begin + return i; + end + i++; + end + return 0; //没找到 + for i := b to e do + begin + if s[i]=c then //找到了 + begin + return i; + end + end + + end + + private + FTokens; + FSates; + FSatesCount; + + FCBBState; + FCBEState; + FCMBState; + FBBStates; + FBEStates; + FMBStates ; + FbgedStates; + FjkhStates; + fcbgesate; + fcjkhState; +end implementation type TBBState =class //括号状态 function Create(t); diff --git a/funcext/tvclib/twincontrol.tsf b/funcext/tvclib/twincontrol.tsf index 370662a..40b0ccc 100644 --- a/funcext/tvclib/twincontrol.tsf +++ b/funcext/tvclib/twincontrol.tsf @@ -2108,13 +2108,13 @@ type TWinControl = class(tcontrol) end end end else - if message=WM_MOVE then + {if message=WM_MOVE then begin x := e.lolparamsigned(); if FClientLeft <> x then FClientLeft := x; y := e.hilparamsigned(); if FClientTop <> y then FClientTop := y; - end else + end else} //if message = WM_MOUSEMOVE then if message=WM_NCHITTEST then // begin diff --git a/funcext/tvclib/utslvclcoolbar.tsf b/funcext/tvclib/utslvclcoolbar.tsf index 0bd2ce0..6e9b03e 100644 --- a/funcext/tvclib/utslvclcoolbar.tsf +++ b/funcext/tvclib/utslvclcoolbar.tsf @@ -176,11 +176,11 @@ type tcustomcoolbar=class(tcustomcontrol) rc := ClientRect; nh := sum(rhs); h := rc[3]-rc[1]; + bw := Height-h; dh := h-nh; if abs(dh)>4 then begin Align := alNone; - if WSSizebox or WsDlgModalFrame or Border then bw := 2; Height := bw+nh; Align := alTop; return ; @@ -314,9 +314,9 @@ type tcustomcoolbar=class(tcustomcontrol) ar+= inttostr(ctls.indexof(v.fctl)); ar+=","; end - ar[length(ar)] := ";"; + ar[length(ar)] := ";"; end - if ar then ar[length(ar):] := ""; + if ar then ar[length(ar):] := ""; return ar; end function setarrange(ar);