优化代码--编辑器

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

View File

@ -609,14 +609,23 @@ type TTslDebuga=class(TCustomControl)
FDebugaddr := '127.0.0.1';
FRuningItem := item;
FCurrentgotoitem := item;
dirs := owner.getlibpathstr();
parsercurrentitem(item);
fio := ioFileseparator();
FDebugUsr := 0;
FDebugPwd := 0;
deletefuncacheini();
////////////////////////////////////////////////////
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;
fremotedbugstart := true;
fscriptbrks := array();
@ -677,6 +686,7 @@ type TTslDebuga=class(TCustomControl)
function Create(AOwner);
begin
inherited;
init_item_height := 30;
fscriptbrks := array();
//Frundirect := false;
FCmdHistory := array();
@ -688,14 +698,14 @@ type TTslDebuga=class(TCustomControl)
dbwnd.Align := alClient;
dbwnd.Parent := 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),
("text":"function","width":250) //,("text":"type","width":70)
);
FStackList.Border := true;
FVaraiblesList := new TGroupGridA(self);
FVaraiblesList.Border := false;
FVaraiblesList.ItemHeight := 23;
FVaraiblesList.ItemHeight := init_item_height;
FVaraiblesList.Columns := array(("text":"name","width":105),
("text":"value","width":135),
("text":"type","width":80)
@ -703,7 +713,7 @@ type TTslDebuga=class(TCustomControl)
FCommandtext := new TEdit(self);
FCommandtext.autosize := true;
FCommandtext.placeholder := "ÃüÁîÊäÈë¿ò";
FCommandtext.Height := 23;
FCommandtext.Height := init_item_height;
FCommandtext.onkeyup := thisfunction(cmdkeyup);
FShowText := new tmemo(self);
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.Visible then continue;
if (ctl is getwndclass()) and ctl.WsPopUp then continue;
if ctl.ignore_childsizing then continue;
if cidx>=fcontrolsperline then
begin
ccount := fcontrolsperline;

View File

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

View File

@ -1993,7 +1993,8 @@ type tsgtkapi = class(tgtkapis)
//begin
//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
begin
cairo_set_source_rgb(dc,135/255,135/255,135/255);
@ -2097,7 +2098,7 @@ type tsgtkapi = class(tgtkapis)
begin
cairo_set_source_rgb(dc,221/255,221/255,221/255);
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_fill(dc);

View File

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

View File

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

View File

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

Binary file not shown.

Binary file not shown.