编辑器

优化编辑器
1.调试
2.右键打开
3.标签切换
This commit is contained in:
JianjunLiu 2023-04-21 10:42:35 +08:00
parent 73bd2e82d3
commit 683605bcda
4 changed files with 49 additions and 56 deletions

View File

@ -1,15 +1,15 @@
//Æô¶¯tsl±à¼­Æ÷
//20230421 整理代码
uses tslvcl;
deletefuncacheini();
//mtic ;
ops := "";
deletefuncacheini(); //清空缓存
ops := ""; //待打开文件
GLobal G_OpenHostory;
G_OpenHostory := true; //ĬÈÏ´ò¿ªÀúÊ·½ø³Ì
G_OpenHostory := true; //默认打开历史文件标记
hasinstance := true; //µ¥¶À½ø³Ì
isdebug := false;
for i:= 0 to sysparamcount() do
begin
if ("-DEBUGSERVER" = sysparamstr(i)) then
if ("-DEBUGSERVER" = sysparamstr(i)) then //调试标记
begin
isdebug := true;
end else
@ -54,7 +54,7 @@ begin
if not FileList("",ops) then
begin
s := "";
n := 512;
n := 1024;//512;
setlength(s,n);
GetCurrentDirectoryA(n,s);
for i:= 1 to n do
@ -82,18 +82,13 @@ begin
end
end else
begin
global g_dotsavehistory;
global g_dotsavehistory; //是否保存打开的历史记录
g_dotsavehistory := true;
end
app := initializeapplication();
//mtic;
//setprofiler(7);
app.createform(class(TRunEditerForm),fm);
fm.OpenAndGotoFileByName(ops);
fm.show();
//echo mtoc;
//d := Getprofilerinfo(true);
//exportfile(ftstream(),"",format("d:\\tst\\profile\\%ssynprofile.stm",tostn(random())),d);
app.run();
type TRunEditerForm = class(TEditerForm)
function Create(AOwner);override;
@ -111,9 +106,10 @@ type TRunEditerForm = class(TEditerForm)
begin
OpenAndGotoFileByName(n);
end
//_wapi.ShowWindow(self.Handle, SW_SHOWNORMAL);
PostMessageA(self.Handle,WM_USER,303,10);
end else
_wapi.ShowWindow(self.Handle, SW_SHOWNORMAL);//确保显示
_Wapi.ForegroundWindow(self.Handle);//PostMessageA(self.Handle,WM_USER,303,10);//放到前端
end {else
if e.wparam = 303 and e.lparam=10 then
begin
//Show(SW_SHOWNORMAL);
@ -133,7 +129,7 @@ type TRunEditerForm = class(TEditerForm)
end
//_wapi.SetForegroundWindow(seLF.Handle);
end
end}
inherited;
end
function CreateParams(p);override;

View File

@ -813,6 +813,7 @@ type TExecuteEditer=class(TCustomControl) //ִ
end
function InsureItemVisible(idx); //移动当前的格子
begin
return ;//
rc := GetIdxRect(idx);
c := ClientRect;
if rc[1]<c[1]then
@ -4232,6 +4233,7 @@ type TEditer=class(TCustomcontrol) //
end else
begin //初始化
bit := GetCurrentItem();
{
for i := 0 to its.Length()-1 do
begin
it := its[i];
@ -4257,10 +4259,23 @@ type TEditer=class(TCustomcontrol) //
it.FPageOrderId := idx++;
end
end
sit := sselect[0]from sr order by[1]asc end;
FCurrentItemCode := sselect[2]from sr order by[1]desc end;
FListPages.SetData(sit);
FListPages.IncIndex(-1);
FCurrentItemCode := sselect[2]from sr order by[1] desc end;
}
sr := array();
cidx := 0;
for i := 0 to its.Length()-1 do
begin
it := its[i];
if it=bit then cidx := i;
sv := it.OrigScriptPath;
if it.FEditer.ChangedFlag then sv := "*"+sv;
sr[i]:= sv;
end
FListPages.SetData(sr);
FListPages.ItemIndex := cidx;
xy := ClientToScreen(100,100);
FListPages.Top := xy[1];
FListPages.Left := xy[0];
@ -5625,6 +5640,8 @@ type TListPages=class(TListBox)
end
function InsureItemVisible(idx); //移动当前的格子
begin
return ;//
//return InsureIdxInClient(idx);
rc := GetIdxRect(idx);
c := ClientRect;
if rc[1]<c[1]then
@ -5651,8 +5668,10 @@ type TListPages=class(TListBox)
idx := getCurrentSelection();
ct := ItemCount;
nidx := idx-f;
if nidx>=ct or nidx<0 then return ;
{
if idx=ct-1 then nidx := 0;
else if idx=-1 then nidx := 1;
else if idx=-1 then nidx := 1;}
SetCurrentSelection(nidx);
InsureItemVisible(nidx);
end

View File

@ -367,7 +367,6 @@ type TTslDebuga=class(TCustomControl)
Fdbgstack;
fdefaultdbger; //±à¼­Æ÷µÄµ÷ÊÔÆ÷
fpopediterhandle;
fcurrentgroundwindow;
type tdbgwnd=class(TPanel)
uses tslvcl;
function Create(AOwner);
@ -837,16 +836,20 @@ type TTslDebuga=class(TCustomControl)
dbgunsetbreak(FConnectchannel,usr,n,idx+1);
end
end
function GetWindowHandleByPID(dwProcessID,api) //通过进程ID获取窗口句柄
function GetWindowHandleByPID(pid,api) //通过进程ID获取窗口句柄
begin
{$ifdef linux}
return 0;
{$endif}
dwProcessID := _wapi.GetProcessId(pid);
h := api.GetTopWindow(0);
while(h) do
begin
pid := 0;
dwTheardId := api.GetWindowThreadProcessId(h,pid);
if(dwTheardId <> 0) and (pid=dwProcessID) then
begin
//while(api.GetParent(h)<> 0) do h := api.GetParent(h); // 原有的处理方式找到最上层
cni := 100;
cn := "";setlength(cn,cni);
cno := api.GetClassNameA(h,cn,cni);
@ -860,26 +863,6 @@ type TTslDebuga=class(TCustomControl)
end
return 0;
end
{function GetWindowHandleByPID2(dwProcessID,api) //通过进程ID获取窗口句柄
begin
h := api.GetTopWindow(0);
while(h) do
begin
pid := 0;
dwTheardId := api.GetWindowThreadProcessId(h,pid);
if(dwTheardId <> 0)then
begin
if(pid=dwProcessID)then
begin
// here h is the handle to the window
while(api.GetParent(h)<> 0) do h := api.GetParent(h);
return h;
end
end
h := api.GetNextWindow(h,2);
end
return 0;
end}
function dbgtooldorun(o,e);
begin
if not(FConnectchannel or FRemoteWait) then
@ -890,17 +873,11 @@ type TTslDebuga=class(TCustomControl)
toolbtnState("¼ÌÐø");
if FCurrentgotoitem and FCurrentgotoitem.FEditer then FCurrentgotoitem.FEditer.ExecuteCommand("ecruningto",nil);
ExecuteCommand("dbgrun");
{$ifdef linux}
{$else}
//if not Fdebugedwhandle then
// Fdebugedwhandle := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi);
fcurrentgroundwindow := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi);
fdoforegroundflag := true;
if fcurrentgroundwindow then
Fdebugedwhandle := GetWindowHandleByPID(fdebugproc.Handle,_wapi);
if Fdebugedwhandle then
begin
_wapi.SetForegroundWindow(fcurrentgroundwindow);
_wapi.SetForegroundWindow(Fdebugedwhandle);
end
{$endif}
end
function Dbgtooldo(o,e)
begin

View File

@ -3541,7 +3541,8 @@ type TcustomListBox=class(TCustomListBoxbase)
SelRange(false);
FSelBegin := FSelEnd := n;
SelRange(true);
SetYpos(n);
//SetYpos(n);
InsureIdxInClient(n);
calllistselchengd();
end
function getItemSelectedState(n);