更新编辑器

This commit is contained in:
2025-03-25 16:20:53 +08:00
parent 254dc0b2cd
commit ab8b5bb6a5
16 changed files with 444 additions and 210 deletions
+30 -2
View File
@@ -67,6 +67,7 @@ function remotetslcallback(data);
function TslToHexFormatStr(tsl);
function HexFormatStrToTsl(D);
function GetTextWidthAndHeightWidthFont(s,f,mul);
function center_popup_wnd(wnd,f);//居中窗口
////////////////////////////////////
//应用
type tapplication=class(tcomponent)
@@ -4339,7 +4340,9 @@ type TDragImageList=class(TCustomImageList)
end
end
protected
procedure Initialize;override;
procedure Initialize();override;
begin
end
public
function create(Owner);override;
begin
@@ -6502,10 +6505,35 @@ function GetTextWidthAndHeightWidthFont(s,f,mul);//
begin
return unit(utslvclgdi).GetTextWidthAndHeightWidthFont(s,f,mul);
end
function CallMessgeFunction(f,o,e); //执行消息回调
function CallMessgeFunction(f,o,e); //执行消息回调
begin
return unit(utslvclauxiliary).CallMessgeFunction(f,o,e);
end
function center_popup_wnd(wnd,f);
begin
////////////////////窗口居中处理/////////////////////////////////
////////////////////wnd待居中的窗口/////////////////////////////////
////////////////////pwnd父窗口/////////////////////////////////
if not((wnd is class(TWinControl)) and wnd.WsPopUp ) then return false;
pd := wnd.parent;
if pd and pd.Visible then
begin
while (ifnil(f) or f) and not(pd.wspopup) do
begin
npd := pd.parent;
if npd then pd := npd;
else break;
end
r := pd.ClientRect;
xy := pd.clienttoscreen(r[0],r[1]);
end else
begin
xy := array(0,0);
r := wnd._wapi.GetScreenRect();
end
wnd.Left := max(0,xy[0]+(r[2]-r[0]-wnd.width)/2) ;
wnd.top := max(0,xy[1]+(r[3]-r[1]-wnd.Height)/2);
end
/////////////////////////初始化////////////////////////////////////
function initallib();
begin
+2 -2
View File
@@ -2784,7 +2784,7 @@ type TSynCompletion = class(TSynCompletionList)
end else
begin
x := xy[0]; y := xy[1];
SetBoundsRect(array(x,y,x+w,y+h)) ;
SetBoundsRect(array(x,y,x+w,y+h));
end
Show(SW_SHOWNOACTIVATE);
//Visible := true;
@@ -2912,7 +2912,7 @@ type TSynCompletion = class(TSynCompletionList)
wd := max(wd,v["clen"]);
end
end
FCurrentWidth := wd;
FCurrentWidth := min(1500,wd);
SetData(d);
if d then
SetCurrentSelection(0);
+9
View File
@@ -57,6 +57,7 @@ function rec_inc(rec,n); //
function get_tsl_mem_ptr(s,n);
function Encode_Password(s); //加密
function Decode_Password(s);//解密
function complementary_color(c);//补色计算
type tuiglobaldata=class() //全局对象存储
static UIData;
class Function uisetdata(n,d);
@@ -2682,6 +2683,10 @@ type tstr_step_match=class()
fcaches[""] := mrows(fits,1);
end
end
function set_init_find_indexs(idxs); //设置初始集合
begin
if ifarray(idxs) and idxs<>fcaches[""] then fcaches := array("":idxs);
end
private
function get_same_idexs(si,idxs);virtual; //直接判断全部
begin
@@ -4542,6 +4547,10 @@ begin
if n>0 then return v+n;
return v;
end
function complementary_color(c);//补色计算
begin
return rgb((255-GetRValue(c)),(255-GetgValue(c)),(255-GetbValue(c)));
end
initialization
uinit();
+5 -3
View File
@@ -340,11 +340,13 @@ type tcustomtabcontrol = class(TCustomControl)
CallMessgeFunction(fondrawtab,self(true),e);
continue;
end
dc.pen.color := 13158600;//rgb(200,200,200);
dc.pen.color := 13158600;//rgb(200,200,200);
if FCurrentid=i then
begin
dc.brush.color := 0xc0b0a0;//rgb(100,192,250);//rgb(230,240,250);//rgb(200,200,200);
end else dc.brush.color := 16711422;//rgb(254,254,254);
bc:= 0xc0b0a0;//rgb(100,192,250);//rgb(230,240,250);//rgb(200,200,200);
end else bc := 16711422;//rgb(254,254,254);
dc.brush.color := bc;
dc.font.color := complementary_color(bc);///////////采用补色
dc.draw("roundrect",array(rec[0:1],rec[2:3],array(2,2)));
rec[1]+=2;
it := FTabItems[i];
+43 -5
View File
@@ -678,7 +678,7 @@ type tcustomcheckbtn=class(tcustombtn) //checkbtn
end
function BMSETCHECK(o,e):BM_SETCHECK;virtual;
begin
FcheckState := e.wparam;
FcheckState := integer(e.wparam);
InvalidateRect(nil,false);
end
function GetPreferredSize(w,h);override;
@@ -3645,10 +3645,11 @@ type TcustomListBox=class(TCustomListBoxbase)
end
idx := GetIdxByYpos(y);
if idx<0 then return;
if FMultisel=2 then
if FMultisel=2 then //非连续选择
begin
end else
if idx <> FSelEnd then
if idx <> FSelEnd then //连续
begin
IncPaintLock();
SelRange(false);
@@ -3671,6 +3672,7 @@ type TcustomListBox=class(TCustomListBoxbase)
@param(rc)(array) 绘制区域%%
@param(cvs)(tcustomcanvas) 画布 %%
**}
bkfc := cvs.font.Color;
r := PaintIdxBkg(idx,rc,cvs);
rc1 := rc;
rc1[4]:=r;
@@ -3697,6 +3699,7 @@ type TcustomListBox=class(TCustomListBoxbase)
rc1[0]+=nh+5;
end
PaintIdexText(idx,rc1,cvs);
cvs.font.Color := bkfc;
end
function PaintIdexText(idx,rc,cvs);virtual;
begin
@@ -4132,6 +4135,7 @@ type TcustomListBox=class(TCustomListBoxbase)
begin
cvs.brush.Color := fselbkcolor;//0xFFE7CB;//rgb(204,231,255);
cvs.FillRect(rc);
if (fselbkcolor .& 0xff000000)<1 then cvs.font.Color := complementary_color(fselbkcolor);
end
end
return r;
@@ -5925,6 +5929,8 @@ type TcustomStatusBar=class(TCustomControl)
function create(AOwner);override;
begin
FItemOder := 0;
fsimpletext := "";
fsimplepanel := 0;
inherited;
height := 25;
Align := alBottom;
@@ -5935,6 +5941,11 @@ type TcustomStatusBar=class(TCustomControl)
c := clientRect;
FCwid := c[2];
FCHei := c[3];
if fsimplepanel then
begin
cvs := Canvas;
return DrawStatItem(cvs,array("text":fsimpletext),c);
end
if FItemOder then return paintb();
painta();
end
@@ -5949,6 +5960,7 @@ type TcustomStatusBar=class(TCustomControl)
if not(wd>0)then wd := 100;
Fitems[Length(Fitems)]:= array("text":str,"width":wd);
if faddlock then return 0;
if fsimplepanel then return ;
if HandleAllocated()then
begin
InvalidateRect(nil,false);
@@ -5962,6 +5974,7 @@ type TcustomStatusBar=class(TCustomControl)
**}
if not(itemidok(idx))then return -1;
deleteindex(Fitems,idx,true);
if fsimplepanel then return ;
if HandleAllocated()then
begin
InValidateRect(nil,false);
@@ -5977,6 +5990,7 @@ type TcustomStatusBar=class(TCustomControl)
if not ifstring(str)then return -1;
if not(itemidok(idx))then return -1;
Fitems[idx,"text"]:= str;
if fsimplepanel then return ;
if HandleAllocated()then
begin
InvalidateRect(nil,false);
@@ -5996,12 +6010,16 @@ type TcustomStatusBar=class(TCustomControl)
property Items:statusitems read Fitems Write SetItems;
property itemtext:string read gettexti write settexti;
property itemwidth:integer read getwidthi write setwidthi;
property itemorder:bool read FItemOder write setitemorder;
property itemorder:bool read FItemOder write setitemorder;
property simplepanel:bool read fsimplepanel write set_simplepanel;
property simpletext:string read fsimpletext write set_simpletext;
{**
@param(Items)(array)设置项 ,二维数组包括 text ,width 两个字段 array(("text":"abc","width":200),("text":"part2","width":0.4))%%
@param(itemtext)(string) 通过索引获取设置文本%%
@param(itemwidth)(integer) 通过索引设置获取宽度%%
@param(itemorder)(bool) item展示排序,默认false从左到右,true为从右到左%%
@param(simplepanel)(bool) 简单面板,只是显示一个字符串%%
@param(simpletext)(string) 简单面板模式下显示的字符串%%
**}
private
faddlock;//添加锁定刷新
@@ -6009,7 +6027,26 @@ type TcustomStatusBar=class(TCustomControl)
FCwid;//宽度
FCHei;//高度
FItemOder;//排序
private
fsimpletext;
fsimplepanel;
private
function set_simplepanel(v);
begin
nv := v?true:false;
if nv<>fsimplepanel then
begin
fsimplepanel := nv;
InvalidateRect(nil,false);
end
end
function set_simpletext(s);
begin
if ifstring(s) and s<>fsimpletext then
begin
fsimpletext := s;
if fsimplepanel then InvalidateRect(nil,false);
end
end
function itemidok(id);
begin
ct := length(Fitems);
@@ -6075,6 +6112,7 @@ type TcustomStatusBar=class(TCustomControl)
if nv<>FItemOder then
begin
FItemOder := nv;
if fsimplepanel then return ;
if FItems then
InvalidateRect(nil,false);
end