优化代码--编辑器

This commit is contained in:
liujianjun 2025-03-14 18:27:47 +08:00
parent d295888137
commit fa201dfc76
11 changed files with 93 additions and 26 deletions

View File

@ -1046,6 +1046,7 @@ type TDVirutalWindow = class(TCustomControl) //
fminusfileds := array(); fminusfileds := array();
FWindowFileds := array("left","top","height","width"); FWindowFileds := array("left","top","height","width");
inherited; inherited;
ignore_childsizing := true;
width := 30; width := 30;
height := 30; height := 30;
end end
@ -1591,6 +1592,7 @@ type TGraphicLabelWindow = class(TDVirutalWindow)
function Create(AOwner);override; function Create(AOwner);override;
begin begin
inherited; inherited;
ignore_childsizing := false;
Parentcolor := true; Parentcolor := true;
BindComp := new tlabel(self); BindComp := new tlabel(self);
width := BindComp.width; width := BindComp.width;
@ -1635,6 +1637,7 @@ type TGraphicbevelWindow = class(TDVirutalWindow)
function Create(AOwner);override; function Create(AOwner);override;
begin begin
inherited; inherited;
ignore_childsizing := false;
Border := false; Border := false;
Parentcolor := true; Parentcolor := true;
bd := new tbevel(self); bd := new tbevel(self);
@ -1691,6 +1694,7 @@ type TGraphicsplitterWindow = class(TDVirutalWindow)
function Create(AOwner);override; function Create(AOwner);override;
begin begin
inherited; inherited;
ignore_childsizing := false;
BindComp := new tsplitter(self); BindComp := new tsplitter(self);
width := BindComp.width; width := BindComp.width;
height := BindComp.Height; height := BindComp.Height;

View File

@ -609,14 +609,23 @@ type TTslDebuga=class(TCustomControl)
FDebugaddr := '127.0.0.1'; FDebugaddr := '127.0.0.1';
FRuningItem := item; FRuningItem := item;
FCurrentgotoitem := item; FCurrentgotoitem := item;
dirs := owner.getlibpathstr();
parsercurrentitem(item); parsercurrentitem(item);
fio := ioFileseparator(); fio := ioFileseparator();
FDebugUsr := 0; FDebugUsr := 0;
FDebugPwd := 0; FDebugPwd := 0;
deletefuncacheini(); deletefuncacheini();
////////////////////////////////////////////////////
getdebuger(pms,pdir); getdebuger(pms,pdir);
exestr := format('"%s" "%s" -DEBUGSERVER -DEBUGLOGIN 0 -WAITATTACH -DEBUGPORT %d -libpath "%s" ',FDebugExe,FRuningfile,FDebugport,(pdir?pdir:dirs)); if not pdir then pdir := owner.getlibpathstr();
if not pdir then pdir := "abc;";
////////////////////////////////////
if pdir then
begin
exestr := format('"%s" "%s" -DEBUGSERVER -DEBUGLOGIN 0 -WAITATTACH -DEBUGPORT %d -libpath "%s" ',FDebugExe,FRuningfile,FDebugport,pdir);
end else
begin
exestr := format('"%s" "%s" -DEBUGSERVER -DEBUGLOGIN 0 -WAITATTACH -DEBUGPORT %d " ',FDebugExe,FRuningfile,FDebugport);
end
exestr += pms; exestr += pms;
fremotedbugstart := true; fremotedbugstart := true;
fscriptbrks := array(); fscriptbrks := array();
@ -677,6 +686,7 @@ type TTslDebuga=class(TCustomControl)
function Create(AOwner); function Create(AOwner);
begin begin
inherited; inherited;
init_item_height := 30;
fscriptbrks := array(); fscriptbrks := array();
//Frundirect := false; //Frundirect := false;
FCmdHistory := array(); FCmdHistory := array();
@ -688,14 +698,14 @@ type TTslDebuga=class(TCustomControl)
dbwnd.Align := alClient; dbwnd.Align := alClient;
dbwnd.Parent := self; dbwnd.Parent := self;
FStackList := new TListView(self); // new TListBox(self); //new tmemo(self);// FStackList := new TListView(self); // new TListBox(self); //new tmemo(self);//
FStackList.ItemHeight := 23; FStackList.ItemHeight := init_item_height;
FStackList.Columns := array(("text":"line","width":80), FStackList.Columns := array(("text":"line","width":80),
("text":"function","width":250) //,("text":"type","width":70) ("text":"function","width":250) //,("text":"type","width":70)
); );
FStackList.Border := true; FStackList.Border := true;
FVaraiblesList := new TGroupGridA(self); FVaraiblesList := new TGroupGridA(self);
FVaraiblesList.Border := false; FVaraiblesList.Border := false;
FVaraiblesList.ItemHeight := 23; FVaraiblesList.ItemHeight := init_item_height;
FVaraiblesList.Columns := array(("text":"name","width":105), FVaraiblesList.Columns := array(("text":"name","width":105),
("text":"value","width":135), ("text":"value","width":135),
("text":"type","width":80) ("text":"type","width":80)
@ -703,7 +713,7 @@ type TTslDebuga=class(TCustomControl)
FCommandtext := new TEdit(self); FCommandtext := new TEdit(self);
FCommandtext.autosize := true; FCommandtext.autosize := true;
FCommandtext.placeholder := "ÃüÁîÊäÈë¿ò"; FCommandtext.placeholder := "ÃüÁîÊäÈë¿ò";
FCommandtext.Height := 23; FCommandtext.Height := init_item_height;
FCommandtext.onkeyup := thisfunction(cmdkeyup); FCommandtext.onkeyup := thisfunction(cmdkeyup);
FShowText := new tmemo(self); FShowText := new tmemo(self);
FShowText.ReadOnly := true; FShowText.ReadOnly := true;

Binary file not shown.

View File

@ -145,7 +145,7 @@ type t_children_sizer = class()
if not ctl then continue; if not ctl then continue;
if not ctl.Visible then continue; if not ctl.Visible then continue;
if (ctl is getwndclass()) and ctl.WsPopUp then continue; if (ctl is getwndclass()) and ctl.WsPopUp then continue;
if ctl.ignore_childsizing then continue;
if cidx>=fcontrolsperline then if cidx>=fcontrolsperline then
begin begin
ccount := fcontrolsperline; ccount := fcontrolsperline;

View File

@ -21,6 +21,7 @@ type tcontrol = class(tcomponent)
FAnchors; FAnchors;
fautosize; fautosize;
fignore_childsizing;
fautosizing; fautosizing;
FAnchorBounds; FAnchorBounds;
FCaption;//标题 FCaption;//标题
@ -1175,6 +1176,7 @@ type tcontrol = class(tcomponent)
function create(aOwner);override; //构造函数 function create(aOwner);override; //构造函数
begin begin
inherited; inherited;
fignore_childsizing := false;
FControlFlags := array(); FControlFlags := array();
fautosize := false; fautosize := false;
if ifnil(FSIDC)then FSIDC := new tidcreater(100); if ifnil(FSIDC)then FSIDC := new tidcreater(100);
@ -1638,6 +1640,7 @@ type tcontrol = class(tcomponent)
//property OnMouseLeave:eventhandler read FOnMouseLeave write FOnMouseLeave; //property OnMouseLeave:eventhandler read FOnMouseLeave write FOnMouseLeave;
property Controls read FControls; property Controls read FControls;
property Canvas: TCanvas read FCanvas; property Canvas: TCanvas read FCanvas;
property ignore_childsizing read fignore_childsizing write fignore_childsizing; //ºöÂÔ
{** {**
@param(Canvas)(TCanvas) 画布对象 %% @param(Canvas)(TCanvas) 画布对象 %%
@param(Controls)(TFpList of tcontrol) 子组件 %% @param(Controls)(TFpList of tcontrol) 子组件 %%

View File

@ -1993,7 +1993,8 @@ type tsgtkapi = class(tgtkapis)
//begin //begin
//end else //end else
cairo_applay_pen_style(dc); //cairo_applay_pen_style(dc);
cairo_set_dash(dc,array(0),0,0);
if dr2 = 0 then // DFCS_BUTTONCHECK if dr2 = 0 then // DFCS_BUTTONCHECK
begin begin
cairo_set_source_rgb(dc,135/255,135/255,135/255); cairo_set_source_rgb(dc,135/255,135/255,135/255);
@ -2097,7 +2098,7 @@ type tsgtkapi = class(tgtkapis)
begin begin
cairo_set_source_rgb(dc,221/255,221/255,221/255); cairo_set_source_rgb(dc,221/255,221/255,221/255);
cairo_set_line_width(dc,0.1); cairo_set_line_width(dc,0.1);
cairo_applay_pen_style(dc); cairo_set_dash(dc,array(0),0,0);//cairo_applay_pen_style(dc);
cairo_rectangle(dc, LPRECT[0]+x, LPRECT[1]+y, LPRECT[2]-LPRECT[0], LPRECT[3]-LPRECT[1]); cairo_rectangle(dc, LPRECT[0]+x, LPRECT[1]+y, LPRECT[2]-LPRECT[0], LPRECT[3]-LPRECT[1]);
cairo_fill(dc); cairo_fill(dc);

View File

@ -55,6 +55,8 @@ function int_to_binary(d,n); //
function rec_inc(rec,n); //挑战区域大小 function rec_inc(rec,n); //挑战区域大小
//function tsl_str_head_at(s,n); //function tsl_str_head_at(s,n);
function get_tsl_mem_ptr(s,n); function get_tsl_mem_ptr(s,n);
function Encode_Password(s); //¼ÓÃÜ
function Decode_Password(s);//½âÃÜ
type tuiglobaldata=class() //全局对象存储 type tuiglobaldata=class() //全局对象存储
static UIData; static UIData;
class Function uisetdata(n,d); class Function uisetdata(n,d);
@ -2436,6 +2438,7 @@ type tfileer_rwraw = class() //
**} **}
function create(); function create();
begin begin
flen := 0;
ffilename := ""; ffilename := "";
fAlias := ""; fAlias := "";
fdatachanged := false; fdatachanged := false;
@ -2464,8 +2467,10 @@ type tfileer_rwraw = class() //
function del();//删除 function del();//删除
begin begin
if not(ifstring(ffilename) and ffilename) then return 0; if not(ifstring(ffilename) and ffilename) then return 0;
if fileexists(fAlias,ffilename) then return true; if not fileexists(fAlias,ffilename) then return 0;
return filedelete(fAlias,ffilename)<>1; r := filedelete(fAlias,ffilename)<>1;
if r then flen := 0;
return r;
end end
function save(); //保存 function save(); //保存
begin begin
@ -2527,6 +2532,7 @@ type tfileer_rwraw = class() //
property Alias read fAlias write fAlias; //目录别名 property Alias read fAlias write fAlias; //目录别名
property data read getdata write setdata; //数据集 property data read getdata write setdata; //数据集
property ftime read floadtime;// property ftime read floadtime;//
property size read flen;//
private private
fAlias; fAlias;
floadtime; floadtime;
@ -2568,7 +2574,7 @@ type tfileer_rwraw = class() //
function inputchanged();//输入改变 function inputchanged();//输入改变
begin begin
fdata := ""; fdata := "";
flen := ""; flen := 0;
floadtime := 0; floadtime := 0;
floaded := false; floaded := false;
end end
@ -3400,6 +3406,43 @@ type t_gbk_text_finder = class() //
frc; frc;
end end
implementation implementation
////////////////////////////////////////
function Encode_Password(s); //¼ÓÃÜ
begin
len := length(s);
if len<2 then
begin
return s;
end;
bs := s;
b := getchar(bs,1);
for i := 1 to len-1 do
begin
b := _xor(getchar(bs,i+1),b);
bS[i+1] := b;
end
bS[1]:= _xor(ord(bs[1]),b);
return bs;
end;
function Decode_Password(s);//½âÃÜ
begin
len := length(s);
if len<2 then
begin
return s;
end;
bs := s;
a := getchar(bs,len);
bS[1]:= _xor(ord(bs[1]),a);
for i := len downto 2 do
begin
b := getchar(bs,i-1);
bS[i]:= _xor(a,b);
a :=b;
end
return bs;
end;
//////////////////////////////////////
function iffuncptr(fn); function iffuncptr(fn);
begin begin
//return datatype(fn)=7; //return datatype(fn)=7;

View File

@ -5120,6 +5120,11 @@ type TcustomToolBar=class(TCustomControl)
if fmainmenu then CalcButtonsRect(); if fmainmenu then CalcButtonsRect();
inherited; inherited;
end end
procedure AdjustSize();override;
begin
inherited;
InvalidateRect(nil,false);
end
function GetPreferredSize(w,h);override; function GetPreferredSize(w,h);override;
begin begin
ft := Font; ft := Font;

View File

@ -960,6 +960,7 @@ type tg_figure = class(tg_evet_conainter) //
break; break;
end end
end end
if not ifarray( nds ) then return ;
d["istrusted"] := true; d["istrusted"] := true;
d["bubbles"] := true; d["bubbles"] := true;
case evtname of case evtname of
@ -2649,24 +2650,24 @@ type tg_axis = class(tg_base) //
xarg := 0;ifh := false;sz:=0; xarg := 0;ifh := false;sz:=0;
tkxys := array(); tkxys := array();
get_axis_type(tpax); get_axis_type(tpax);
////////////×ø±êÖá±ß½ç///////////////////////////////
if fzoom_bounds then if fzoom_bounds then
begin begin
v_to_cvs(tpax,fzoom_bounds[0],x,y); minv := fzoom_bounds[0];
tkxys[0] := array(x,y); manv := fzoom_bounds[1];
v_to_cvs(tpax,fzoom_bounds[1],x2,y2);
tkxys[1] := array(x2,y2);
sz := (x2-x)^2+(y2-y)^2;
if sz>0 then sz := sqrt(sz);
end else end else
begin begin
minv := minvalue(fxtics_coord_v); minv := minvalue(fxtics_coord_v);
manv := maxvalue(fxtics_coord_v); manv := maxvalue(fxtics_coord_v);
end
if not(minv<manv) then return false; if not(minv<manv) then return false;
//////////////////////////////////////////////
v_to_cvs(tpax,minv,x,y); v_to_cvs(tpax,minv,x,y);
tkxys[0] := array(x,y); tkxys[0] := array(x,y);
v_to_cvs(tpax,manv,x,y); v_to_cvs(tpax,manv,x2,y2);
tkxys[1] := array(x,y); tkxys[1] := array(x2,y2);
end sz := (x2-x)^2+(y2-y)^2;
if sz>0 then sz := sqrt(sz);
if length(tkxys)<2 then return false; if length(tkxys)<2 then return false;
dxy := (tkxys[1]-tkxys[0]); dxy := (tkxys[1]-tkxys[0]);
if (like_0(dxy[0])) and like_0(dxy[1]) then return false; if (like_0(dxy[0])) and like_0(dxy[1]) then return false;

Binary file not shown.

Binary file not shown.